diff --git a/.env b/.env index f365aa35..2fd995d3 100644 --- a/.env +++ b/.env @@ -1,11 +1,16 @@ # Proxy urls VITE_USE_PROXYURL=true -VITE_PROXYURL_WMS="https://map.geoportail.lu/ogcproxywms" -VITE_PROXYURL_REMOTE="https://map.geoportail.lu/httpsproxy" +VITE_PROXYURL_WMS="/ogcproxywms" +VITE_PROXYURL_REMOTE="/httpsproxy" + +# Urls for metadata, metadata links and legends +VITE_GEONETWORK_URL="https://geocatalogue.geoportail.lu/geonetwork/srv" +VITE_GET_LEGENDS_URL="/legends/get_html" +VITE_GET_METADATA_URL="/getMetadata" # Paths for symbols -VITE_SYMBOL_ICONS_URL="https://map.geoportail.lu/mymaps" -VITE_SYMBOLS_URL="https://map.geoportail.lu/mymaps/symbols" +VITE_SYMBOL_ICONS_URL="/mymaps" +VITE_SYMBOLS_URL="/mymaps/symbols" # Urls for vectortiles VITE_VECTORTILES_URL="https://vectortiles.geoportail.lu" diff --git a/.env.development b/.env.development index 2ed22507..ec143a9c 100644 --- a/.env.development +++ b/.env.development @@ -1,11 +1,16 @@ # Proxy urls VITE_USE_PROXYURL=true -VITE_PROXYURL_WMS="https://map.geoportail.lu/ogcproxywms" -VITE_PROXYURL_REMOTE="https://map.geoportail.lu/httpsproxy" +VITE_PROXYURL_WMS="https://migration.geoportail.lu/ogcproxywms" +VITE_PROXYURL_REMOTE="https://migration.geoportail.lu/httpsproxy" + +# Urls for metadata, metadata links and legends +VITE_GEONETWORK_URL="https://geocatalogue.geoportail.lu/geonetwork/srv" +VITE_GET_LEGENDS_URL="https://migration.geoportail.lu/legends/get_html" +VITE_GET_METADATA_URL="https://migration.geoportail.lu/getMetadata" # Paths for symbols -VITE_SYMBOL_ICONS_URL="https://map.geoportail.lu/mymaps" -VITE_SYMBOLS_URL="https://map.geoportail.lu/mymaps/symbols" +VITE_SYMBOL_ICONS_URL="https://map.geoportail.lu/mymaps" # !!! use prod because of CORS +VITE_SYMBOLS_URL="https://map.geoportail.lu/mymaps/symbols" # !!! use prod because of CORS # Urls for vectortiles VITE_VECTORTILES_URL="https://vectortiles.geoportail.lu" diff --git a/.env.e2e b/.env.e2e index 86f146b3..59583476 100644 --- a/.env.e2e +++ b/.env.e2e @@ -3,9 +3,14 @@ VITE_USE_PROXYURL=true VITE_PROXYURL_WMS="https://map.geoportail.lu/ogcproxywms" VITE_PROXYURL_REMOTE="https://map.geoportail.lu/httpsproxy" +# Urls for metadata, metadata links and legends +VITE_GEONETWORK_URL="https://geocatalogue.geoportail.lu/geonetwork/srv" +VITE_GET_LEGENDS_URL="https://migration.geoportail.lu/legends/get_html" +VITE_GET_METADATA_URL="https://migration.geoportail.lu/getMetadata" + # Paths for symbols -VITE_SYMBOL_ICONS_URL="https://map.geoportail.lu/mymaps" -VITE_SYMBOLS_URL="https://map.geoportail.lu/mymaps/symbols" +VITE_SYMBOL_ICONS_URL="https://map.geoportail.lu/mymaps" # !!! use prod because of CORS +VITE_SYMBOLS_URL="https://map.geoportail.lu/mymaps/symbols" # !!! use prod because of CORS # Urls for vectortiles VITE_VECTORTILES_URL="https://vectortiles.geoportail.lu" diff --git a/.env.staging b/.env.staging index 2d56c218..619afc3b 100644 --- a/.env.staging +++ b/.env.staging @@ -1,11 +1,16 @@ # Proxy urls VITE_USE_PROXYURL=true -VITE_PROXYURL_WMS="https://map.geoportail.lu/ogcproxywms" -VITE_PROXYURL_REMOTE="https://map.geoportail.lu/httpsproxy" +VITE_PROXYURL_WMS="https://migration.geoportail.lu/ogcproxywms" +VITE_PROXYURL_REMOTE="https://migration.geoportail.lu/httpsproxy" + +# Urls for metadata, metadata links and legends +VITE_GEONETWORK_URL="https://geocatalogue.geoportail.lu/geonetwork/srv" +VITE_GET_LEGENDS_URL="https://migration.geoportail.lu/legends/get_html" +VITE_GET_METADATA_URL="https://migration.geoportail.lu/getMetadata" # Paths for symbols -VITE_SYMBOL_ICONS_URL="https://map.geoportail.lu/mymaps" -VITE_SYMBOLS_URL="https://map.geoportail.lu/mymaps/symbols" +VITE_SYMBOL_ICONS_URL="https://migration.geoportail.lu/mymaps" +VITE_SYMBOLS_URL="https://migration.geoportail.lu/mymaps/symbols" # Urls for vectortiles VITE_VECTORTILES_URL="https://vectortiles-staging.geoportail.lu" diff --git a/src/services/layer-metadata/layer-metadata.service.ts b/src/services/layer-metadata/layer-metadata.service.ts index a6ca718d..4d3d83cd 100644 --- a/src/services/layer-metadata/layer-metadata.service.ts +++ b/src/services/layer-metadata/layer-metadata.service.ts @@ -11,14 +11,11 @@ import { LayerId } from '@/stores/map.store.model' import { remoteMetadataHelper } from './remote-metadata.helper' import { REMOTE_SERVICE_TYPE } from '../remote-layers/remote-layers.model' -export class LayerMetadataService { - // TODO: get urls from a config - private geonetworkBaseUrl = - 'https://geocatalogue.geoportail.lu/geonetwork/srv' - private legendBaseUrl = 'https://map.geoportail.lu/legends/get_html' - // TODO: get from config or relative - private localMetadataBaseUrl = 'https://map.geoportail.lu/getMetadata' +const GEONETWORK_URL = import.meta.env.VITE_GEONETWORK_URL +const GET_LEGENDS_URL = import.meta.env.VITE_GET_LEGENDS_URL +const GET_METADATA_URL = import.meta.env.VITE_GET_METADATA_URL +export class LayerMetadataService { async getLayerMetadata(id: LayerId, currentLanguage: string) { const themesService = useThemes() const layer: ThemeNodeModel | undefined = @@ -34,7 +31,7 @@ export class LayerMetadataService { const metadata = metadataId && (await this.getLocalMetadata( - this.localMetadataBaseUrl, + GET_METADATA_URL, metadataId, currentLanguage )) @@ -45,7 +42,7 @@ export class LayerMetadataService { const legendHtml = legendName && (await this.getLegendHtml( - this.legendBaseUrl, + GET_LEGENDS_URL, legendName, layerId, currentLanguage @@ -90,7 +87,7 @@ export class LayerMetadataService { responsibleParty: metadata.responsibleParty ? getResponsibleParty(metadata.responsibleParty) : undefined, - metadataLink: `${this.geonetworkBaseUrl}/${isoLang2To3( + metadataLink: `${GEONETWORK_URL}/${isoLang2To3( language )}/catalog.search#/metadata/${metadataUid}`, isError: false,