diff --git a/build-utils/config-loader.js b/build-utils/config-loader.js index c9f461b908..00364ae1ba 100644 --- a/build-utils/config-loader.js +++ b/build-utils/config-loader.js @@ -41,6 +41,14 @@ module.exports = function(source) { } }); + // The API root is defined in the config. In most cases this will be set to + // point to the dev API. If the .env defines a different API root, use that + // value here. Use the API_ROOT key in the .env to set a new API root. Note + // that this replaces the old SITE_URL key. + if (process.env.API_ROOT) { + config.app.api_root = process.env.API_ROOT; + } + // Strip out gettext syntax; we don't perform any localization of the config // in this loader. Full localization is performed by the production build. walk(config, (val, prop, obj) => { @@ -49,10 +57,9 @@ module.exports = function(source) { val = val .replace(configGettextRegex, "") .replace(/\)$/, ""); + obj[prop] = val; } } - - obj[prop] = val; }); const templateSource = fs.readFileSync( diff --git a/src/flavors/bogtobay/config.yml b/src/flavors/bogtobay/config.yml index b071c16b9c..11bff3b00d 100644 --- a/src/flavors/bogtobay/config.yml +++ b/src/flavors/bogtobay/config.yml @@ -11,7 +11,7 @@ app: # This should be set to the root of an api server from which you'd like to draw # permissions information for logged-in users. This value can be overridden - # using the SITE_KEY environment variable. Note the trailing slash. + # using the API_ROOT environment variable. Note the trailing slash. api_root: https://dev-api.heyduwamish.org/api/v2/ # When the map loads, existing places will be loaded in chunks. By default, diff --git a/src/flavors/central-puget-sound/config.yml b/src/flavors/central-puget-sound/config.yml index a1ecdac8ee..ed784b0de1 100644 --- a/src/flavors/central-puget-sound/config.yml +++ b/src/flavors/central-puget-sound/config.yml @@ -11,7 +11,7 @@ app: # This should be set to the root of an api server from which you'd like to draw # permissions information for logged-in users. This value can be overridden - # using the SITE_KEY environment variable. Note the trailing slash. + # using the API_ROOT environment variable. Note the trailing slash. api_root: https://dev-api.heyduwamish.org/api/v2/ # When the map loads, existing places will be loaded in chunks. By default, diff --git a/src/flavors/defaultflavor/config.yml b/src/flavors/defaultflavor/config.yml index 782203adb1..e8502f4686 100644 --- a/src/flavors/defaultflavor/config.yml +++ b/src/flavors/defaultflavor/config.yml @@ -11,7 +11,7 @@ app: # This should be set to the root of an api server from which you'd like to draw # permissions information for logged-in users. This value can be overridden - # using the SITE_KEY environment variable. Note the trailing slash. + # using the API_ROOT environment variable. Note the trailing slash. api_root: https://dev-api.heyduwamish.org/api/v2/ # When the map loads, existing places will be loaded in chunks. By default, diff --git a/src/flavors/duwamish-watershed/config.yml b/src/flavors/duwamish-watershed/config.yml index 6e91749908..a9b1d670aa 100644 --- a/src/flavors/duwamish-watershed/config.yml +++ b/src/flavors/duwamish-watershed/config.yml @@ -11,7 +11,7 @@ app: # This should be set to the root of an api server from which you'd like to draw # permissions information for logged-in users. This value can be overridden - # using the SITE_KEY environment variable. Note the trailing slash. + # using the API_ROOT environment variable. Note the trailing slash. api_root: https://dev-api.heyduwamish.org/api/v2/ # When the map loads, existing places will be loaded in chunks. By default, diff --git a/src/flavors/duwamish_flavor/config.yml b/src/flavors/duwamish_flavor/config.yml index 7eb5e98b7b..7bbd40008c 100644 --- a/src/flavors/duwamish_flavor/config.yml +++ b/src/flavors/duwamish_flavor/config.yml @@ -11,7 +11,7 @@ app: # This should be set to the root of an api server from which you'd like to draw # permissions information for logged-in users. This value can be overridden - # using the SITE_KEY environment variable. Note the trailing slash. + # using the API_ROOT environment variable. Note the trailing slash. api_root: https://dev-api.heyduwamish.org/api/v2/ # Fallback image to use for sharing on social services if no model image is present diff --git a/src/flavors/greensboropb/config.yml b/src/flavors/greensboropb/config.yml index f8a4e58bdc..a196e287a7 100755 --- a/src/flavors/greensboropb/config.yml +++ b/src/flavors/greensboropb/config.yml @@ -9,7 +9,7 @@ app: # This should be set to the root of an api server from which you'd like to draw # permissions information for logged-in users. This value can be overridden - # using the SITE_KEY environment variable. Note the trailing slash. + # using the API_ROOT environment variable. Note the trailing slash. api_root: https://dev-api.heyduwamish.org/api/v2/ district: diff --git a/src/flavors/greenways/config.yml b/src/flavors/greenways/config.yml index 07df4943cb..b516dd6d42 100644 --- a/src/flavors/greenways/config.yml +++ b/src/flavors/greenways/config.yml @@ -11,7 +11,7 @@ app: # This should be set to the root of an api server from which you'd like to draw # permissions information for logged-in users. This value can be overridden - # using the SITE_KEY environment variable. Note the trailing slash. + # using the API_ROOT environment variable. Note the trailing slash. api_root: https://dev-api.heyduwamish.org/api/v2/ # When the map loads, existing places will be loaded in chunks. By default, diff --git a/src/flavors/gtopenspace/config.yml b/src/flavors/gtopenspace/config.yml index c9718f8870..c1bafe7bc8 100644 --- a/src/flavors/gtopenspace/config.yml +++ b/src/flavors/gtopenspace/config.yml @@ -11,7 +11,7 @@ app: # This should be set to the root of an api server from which you'd like to draw # permissions information for logged-in users. This value can be overridden - # using the SITE_KEY environment variable. Note the trailing slash. + # using the API_ROOT environment variable. Note the trailing slash. api_root: https://dev-api.heyduwamish.org/api/v2/ # When the map loads, existing places will be loaded in chunks. By default, diff --git a/src/flavors/lakewashington/config.yml b/src/flavors/lakewashington/config.yml index 37d4ac3ebc..d3c0fdef1f 100644 --- a/src/flavors/lakewashington/config.yml +++ b/src/flavors/lakewashington/config.yml @@ -11,7 +11,7 @@ app: # This should be set to the root of an api server from which you'd like to draw # permissions information for logged-in users. This value can be overridden - # using the SITE_KEY environment variable. Note the trailing slash. + # using the API_ROOT environment variable. Note the trailing slash. api_root: https://dev-api.heyduwamish.org/api/v2/ # When the map loads, existing places will be loaded in chunks. By default, diff --git a/src/flavors/madrid/config.yml b/src/flavors/madrid/config.yml index b3012d298c..0b361f4720 100644 --- a/src/flavors/madrid/config.yml +++ b/src/flavors/madrid/config.yml @@ -17,6 +17,11 @@ app: # Optional. List view is supported by default. Set to false to disable. # list_enabled: false + # This should be set to the root of an api server from which you'd like to draw + # permissions information for logged-in users. This value can be overridden + # using the API_ROOT environment variable. Note the trailing slash. + api_root: https://dev-api.heyduwamish.org/api/v2/ + # languages: # - code: en # label: I Speak English diff --git a/src/flavors/pboakland/config.yml b/src/flavors/pboakland/config.yml index abb364772d..ccad72100c 100644 --- a/src/flavors/pboakland/config.yml +++ b/src/flavors/pboakland/config.yml @@ -11,7 +11,7 @@ app: # This should be set to the root of an api server from which you'd like to draw # permissions information for logged-in users. This value can be overridden - # using the SITE_KEY environment variable. Note the trailing slash. + # using the API_ROOT environment variable. Note the trailing slash. api_root: https://dev-api.heyduwamish.org/api/v2/ # When the map loads, existing places will be loaded in chunks. By default, diff --git a/src/flavors/pugetsound/config.yml b/src/flavors/pugetsound/config.yml index 04fd87708e..e916fa2ddb 100644 --- a/src/flavors/pugetsound/config.yml +++ b/src/flavors/pugetsound/config.yml @@ -11,7 +11,7 @@ app: # This should be set to the root of an api server from which you'd like to draw # permissions information for logged-in users. This value can be overridden - # using the SITE_KEY environment variable. Note the trailing slash. + # using the API_ROOT environment variable. Note the trailing slash. api_root: https://dev-api.heyduwamish.org/api/v2/ # When the map loads, existing places will be loaded in chunks. By default, diff --git a/src/flavors/rail/config.yml b/src/flavors/rail/config.yml index 1cd6ca9f26..98ba8e3107 100644 --- a/src/flavors/rail/config.yml +++ b/src/flavors/rail/config.yml @@ -11,7 +11,7 @@ app: # This should be set to the root of an api server from which you'd like to draw # permissions information for logged-in users. This value can be overridden - # using the SITE_KEY environment variable. Note the trailing slash. + # using the API_ROOT environment variable. Note the trailing slash. api_root: https://dev-api.heyduwamish.org/api/v2/ # When the map loads, existing places will be loaded in chunks. By default, diff --git a/src/flavors/raingardens/config.yml b/src/flavors/raingardens/config.yml index 55cb0ae14a..3f4d2c8990 100644 --- a/src/flavors/raingardens/config.yml +++ b/src/flavors/raingardens/config.yml @@ -13,7 +13,7 @@ app: # This should be set to the root of an api server from which you'd like to draw # permissions information for logged-in users. This value can be overridden - # using the SITE_KEY environment variable. Note the trailing slash. + # using the API_ROOT environment variable. Note the trailing slash. api_root: https://dev-api.heyduwamish.org/api/v2/ # When the map loads, existing places will be loaded in chunks. By default, diff --git a/src/flavors/snoqualmie/config.yml b/src/flavors/snoqualmie/config.yml index 04c59c8d81..4ba59e6b87 100644 --- a/src/flavors/snoqualmie/config.yml +++ b/src/flavors/snoqualmie/config.yml @@ -11,7 +11,7 @@ app: # This should be set to the root of an api server from which you'd like to draw # permissions information for logged-in users. This value can be overridden - # using the SITE_KEY environment variable. Note the trailing slash. + # using the API_ROOT environment variable. Note the trailing slash. api_root: https://dev-api.heyduwamish.org/api/v2/ # When the map loads, existing places will be loaded in chunks. By default, diff --git a/src/flavors/trees/config.yml b/src/flavors/trees/config.yml index 52e2a2f8be..3d5800d151 100644 --- a/src/flavors/trees/config.yml +++ b/src/flavors/trees/config.yml @@ -13,7 +13,7 @@ app: # This should be set to the root of an api server from which you'd like to draw # permissions information for logged-in users. This value can be overridden - # using the SITE_KEY environment variable. Note the trailing slash. + # using the API_ROOT environment variable. Note the trailing slash. api_root: https://dev-api.heyduwamish.org/api/v2/ # When the map loads, existing places will be loaded in chunks. By default, diff --git a/src/flavors/waterfront/config.yml b/src/flavors/waterfront/config.yml index 1033c3661c..b7dd19fbbc 100644 --- a/src/flavors/waterfront/config.yml +++ b/src/flavors/waterfront/config.yml @@ -11,7 +11,7 @@ app: # This should be set to the root of an api server from which you'd like to draw # permissions information for logged-in users. This value can be overridden - # using the SITE_KEY environment variable. Note the trailing slash. + # using the API_ROOT environment variable. Note the trailing slash. api_root: https://dev-api.heyduwamish.org/api/v2/ # When the map loads, existing places will be loaded in chunks. By default, diff --git a/src/flavors/willamette/config.yml b/src/flavors/willamette/config.yml index e30e7f7786..5769a648cf 100644 --- a/src/flavors/willamette/config.yml +++ b/src/flavors/willamette/config.yml @@ -11,7 +11,7 @@ app: # This should be set to the root of an api server from which you'd like to draw # permissions information for logged-in users. This value can be overridden - # using the SITE_KEY environment variable. Note the trailing slash. + # using the API_ROOT environment variable. Note the trailing slash. api_root: https://dev-api.heyduwamish.org/api/v2/ # When the map loads, existing places will be loaded in chunks. By default, diff --git a/static-build.js b/static-build.js index 03b700d180..161f664f75 100644 --- a/static-build.js +++ b/static-build.js @@ -73,7 +73,7 @@ if (!flavor) { // This version number is only used for cache-busting on our bundle.js // and bundle.css files. -const bundleVersion = "0.7.5.7"; +const bundleVersion = "0.7.5.9"; const flavorBasePath = path.resolve( __dirname, @@ -266,6 +266,13 @@ activeLanguages.forEach((language) => { } }); + // The API root is defined in the config. In most cases this will be set to + // point to the dev API. If the .env defines a different API root, use that + // value here. Use the API_ROOT key in the .env to set a new API root. Note + // that this replaces the old SITE_URL key. + if (process.env.API_ROOT) { + thisConfig.app.api_root = process.env.API_ROOT; + } // (5a) Copy all jstemplates and flavor pages to a working directory from // which the templates can be localized and precompiled. Also resolve