Skip to content

Commit

Permalink
add VITE_GIS_SERVICES_URL to env
Browse files Browse the repository at this point in the history
  • Loading branch information
devincowan committed Feb 15, 2024
1 parent 3984501 commit 770c811
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
4 changes: 3 additions & 1 deletion app/env.template
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,6 @@ OAUTH2_REDIRECT_URL=https://localhost/api/auth/cuahsi/callback
# VITE_OAUTH2_REDIRECT_URL="${VITE_APP_FULL_URL}#/auth-redirect"
VITE_OAUTH2_REDIRECT_URL="https://localhost/#/auth-redirect"

OIDC_BASE_URL=https://auth.cuahsi.org/realms/CUAHSI/protocol/openid-connect/
OIDC_BASE_URL=https://auth.cuahsi.org/realms/CUAHSI/protocol/openid-connect/

VITE_GIS_SERVICES_URL=https://arcgis.cuahsi.org/arcgis/services
1 change: 1 addition & 0 deletions app/frontend/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ do
sed -i 's|VITE_APP_API_URL_PLACEHOLDER|'${VITE_APP_API_URL}'|g' $file
sed -i 's|VITE_APP_FULL_URL_PLACEHOLDER|'${VITE_APP_FULL_URL}'|g' $file
sed -i 's|VITE_APP_BASE_PLACEHOLDER|'${VITE_APP_BASE}'|g' $file
sed -i 's|VITE_GIS_SERVICES_URL_PLACEHOLDER|'${VITE_GIS_SERVICES_URL}'|g' $file
done

exec "$@"
13 changes: 7 additions & 6 deletions app/frontend/src/components/TheLeafletMap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { onMounted, onUpdated } from 'vue'
import { useMapStore } from '@/stores/map'
import { useModelsStore } from '@/stores/models'
import { useAlertStore } from '@/stores/alerts'
import { GIS_SERVICES_URL } from '@/constants'
const mapStore = useMapStore()
const modelsStore = useModelsStore();
Expand Down Expand Up @@ -91,7 +92,7 @@ onMounted(() => {
}).addTo(map);
// WMS LAYER
let url = 'http://arcgis.cuahsi.org/arcgis/services/US_WBD/HUC_WBD/MapServer/WmsServer?'
let url = `${GIS_SERVICES_URL}/US_WBD/HUC_WBD/MapServer/WmsServer?`
// HUC WMS Naming
// --------------
Expand Down Expand Up @@ -139,7 +140,7 @@ onMounted(() => {
}).addTo(map);
// add USGS gage layer to map
url = 'http://arcgis.cuahsi.org/arcgis/services/NHD/usgs_gages/MapServer/WmsServer?';
url = `${GIS_SERVICES_URL}/NHD/usgs_gages/MapServer/WmsServer?`;
let gages = L.tileLayer.wms(url, {
layers: 0,
transparent: 'true',
Expand Down Expand Up @@ -423,7 +424,7 @@ async function getGageInfo(e) {
SrsName: 'EPSG:4326',
outputFormat: 'ESRIGEOJSON'
};
let root = 'https://arcgis.cuahsi.org/arcgis/services/NHD/usgs_gages/MapServer/WFSServer';
let root = `${GIS_SERVICES_URL}/NHD/usgs_gages/MapServer/WFSServer`;
let parameters = L.Util.extend(defaultParameters);
let gageURL = root + L.Util.getParamString(parameters);
Expand Down Expand Up @@ -502,7 +503,7 @@ async function mapClick(e) {
typeName: 'HUC_WBD:HUC12_US',
SrsName: 'EPSG:4326'
};
let root = 'https://arcgis.cuahsi.org/arcgis/services/US_WBD/HUC_WBD/MapServer/WFSServer';
let root = `${GIS_SERVICES_URL}/US_WBD/HUC_WBD/MapServer/WFSServer`;
let parameters = L.Util.extend(defaultParameters);
let URL = root + L.Util.getParamString(parameters);
Expand Down Expand Up @@ -570,7 +571,7 @@ function traceUpstream(usgs_gage) {
typeName: 'HUC_WBD:HUC12_US',
SrsName: 'EPSG:4326'
};
let root = 'https://arcgis.cuahsi.org/arcgis/services/US_WBD/HUC_WBD/MapServer/WFSServer';
let root = `${GIS_SERVICES_URL}/US_WBD/HUC_WBD/MapServer/WFSServer`;
let parameters = L.Util.extend(defaultParameters);
let URL = root + L.Util.getParamString(parameters);
Expand Down Expand Up @@ -810,7 +811,7 @@ function addFeatureByHUC(hucid) {
SrsName: 'EPSG:4326',
Filter: filter
};
let root = 'https://arcgis.cuahsi.org/arcgis/services/US_WBD/HUC_WBD/MapServer/WFSServer';
let root = `${GIS_SERVICES_URL}/US_WBD/HUC_WBD/MapServer/WFSServer`;
let parameters = L.Util.extend(defaultParameters);
let URL = root + L.Util.getParamString(parameters);
Expand Down
2 changes: 2 additions & 0 deletions app/frontend/src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ export const APP_BASE = import.meta.env.VITE_APP_BASE || "VITE_APP_BASE_PLACEHOL
let APP_URL_IN = import.meta.env.VITE_APP_FULL_URL || "VITE_APP_FULL_URL_PLACEHOLDER";
export const APP_URL = APP_URL_IN.endsWith("/") ? APP_URL_IN : `${APP_URL_IN}/`

export const GIS_SERVICES_URL = import.meta.env.VITE_GIS_SERVICES_URL || "VITE_GIS_SERVICES_URL_PLACEHOLDER";

export const API_BASE = import.meta.env.VITE_APP_API_URL || "VITE_APP_API_URL_PLACEHOLDER";
export const ENDPOINTS = {
openapi: `${API_BASE}/openapi.json`,
Expand Down

0 comments on commit 770c811

Please sign in to comment.