diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index f9c1bbea..60418511 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -19,6 +19,7 @@ jobs: ATB_NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=${{ github.event_name == 'release' && 'atb-mobility-platform.firebaseapp.com' || 'atb-mobility-platform-staging.firebaseapp.com' }} ATB_NEXT_PUBLIC_FIREBASE_APP_ID=${{ github.event_name == 'release' && '1:827196677776:web:c4b1d8924bb5778bf50215' || '1:939812594010:web:0308b2a9cdc80b0d069363' }} ATB_NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID=${{ github.event_name == 'release' && '' || '' }} + ATB_NEXT_PUBLIC_IN_STAGING=${{ github.event_name == 'atb-mobility-platform-staging'}} NFK_NEXT_PUBLIC_MAPBOX_DEFAULT_LAT=67.280357 NFK_NEXT_PUBLIC_MAPBOX_DEFAULT_LNG=14.404916 NFK_NEXT_PUBLIC_FIREBASE_PROJECT_ID=${{ github.event_name == 'release' && 'nfk-prod' || 'nfk-staging'}} @@ -26,6 +27,7 @@ jobs: NFK_NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=${{ github.event_name == 'release' && 'nfk-prod.firebaseapp.com' || 'nfk-staging.firebaseapp.com' }} NFK_NEXT_PUBLIC_FIREBASE_APP_ID=${{ github.event_name == 'release' && '1:638315587956:web:51e95a11a03f27dc9ca421' || '1:793301954236:web:908723b8ded2824cadeab9' }} NFK_NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID=${{ github.event_name == 'release' && '' || '' }} + NFK_NEXT_PUBLIC_IN_STAGING=${{ github.event_name == 'nfk-staging'}} FRAM_NEXT_PUBLIC_MAPBOX_DEFAULT_LAT=62.4705 FRAM_NEXT_PUBLIC_MAPBOX_DEFAULT_LNG=6.1533 FRAM_NEXT_PUBLIC_FIREBASE_PROJECT_ID=${{ github.event_name == 'release' && 'fram-prod-a7850' || 'fram-staging'}} @@ -33,6 +35,7 @@ jobs: FRAM_NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=${{ github.event_name == 'release' && 'fram-prod-a7850.firebaseapp.com' || 'fram-staging.firebaseapp.com' }} FRAM_NEXT_PUBLIC_FIREBASE_APP_ID=${{ github.event_name == 'release' && '1:717595301444:web:1e16129330d562f1b3ce11' || '1:312905478211:web:41c6f9db83ae5ef0efa4f6' }} FRAM_NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID=${{ github.event_name == 'release' && 'G-KS45JBFWF4' || '' }} + FRAM_NEXT_PUBLIC_IN_STAGING=${{ github.event_name == 'fram-staging'}} TROMS_NEXT_PUBLIC_MAPBOX_DEFAULT_LAT=69.665229 TROMS_NEXT_PUBLIC_MAPBOX_DEFAULT_LNG=18.9070347 TROMS_NEXT_PUBLIC_FIREBASE_PROJECT_ID=${{ github.event_name == 'release' && '' || 'troms-staging'}} @@ -40,6 +43,7 @@ jobs: TROMS_NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=${{ github.event_name == 'release' && '' || 'troms-staging.firebaseapp.com' }} TROMS_NEXT_PUBLIC_FIREBASE_APP_ID=${{ github.event_name == 'release' && '' || '1:973624729382:web:a84d8a489613a14be12be7' }} TROMS_NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID='' + TROMS_NEXT_PUBLIC_IN_STAGING=${{ github.event_name == 'troms-staging'}} secrets: github_pat: ${{ secrets.GH_PAT }} build_secrets: | diff --git a/Dockerfile b/Dockerfile index 6b15195e..ff8d8fed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,6 +22,7 @@ ARG ATB_NEXT_PUBLIC_FIREBASE_PUBLIC_API_KEY ARG ATB_NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN ARG ATB_NEXT_PUBLIC_FIREBASE_APP_ID ARG ATB_NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID +ARG ATB_NEXT_PUBLIC_IN_STAGING ARG NFK_NEXT_PUBLIC_MAPBOX_DEFAULT_LAT ARG NFK_NEXT_PUBLIC_MAPBOX_DEFAULT_LNG @@ -30,6 +31,7 @@ ARG NFK_NEXT_PUBLIC_FIREBASE_PUBLIC_API_KEY ARG NFK_NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN ARG NFK_NEXT_PUBLIC_FIREBASE_APP_ID ARG NFK_NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID +ARG NFK_NEXT_PUBLIC_IN_STAGING ARG FRAM_NEXT_PUBLIC_MAPBOX_DEFAULT_LAT ARG FRAM_NEXT_PUBLIC_MAPBOX_DEFAULT_LNG @@ -38,6 +40,7 @@ ARG FRAM_NEXT_PUBLIC_FIREBASE_PUBLIC_API_KEY ARG FRAM_NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN ARG FRAM_NEXT_PUBLIC_FIREBASE_APP_ID ARG FRAM_NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID +ARG FRAM_NEXT_PUBLIC_IN_STAGING ARG TROMS_NEXT_PUBLIC_MAPBOX_DEFAULT_LAT ARG TROMS_NEXT_PUBLIC_MAPBOX_DEFAULT_LNG @@ -46,6 +49,7 @@ ARG TROMS_NEXT_PUBLIC_FIREBASE_PUBLIC_API_KEY ARG TROMS_NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN ARG TROMS_NEXT_PUBLIC_FIREBASE_APP_ID ARG TROMS_NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID +ARG TROMS_NEXT_PUBLIC_IN_STAGING # Generate GraphQL files RUN yarn generate @@ -59,6 +63,7 @@ ENV NEXT_PUBLIC_FIREBASE_PUBLIC_API_KEY=$ATB_NEXT_PUBLIC_FIREBASE_PUBLIC_API_KEY ENV NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=$ATB_NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN ENV NEXT_PUBLIC_FIREBASE_APP_ID=$ATB_NEXT_PUBLIC_FIREBASE_APP_ID ENV NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID=$ATB_NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID +ENV NEXT_PUBLIC_IN_STAGING=$ATB_NEXT_PUBLIC_IN_STAGING RUN --mount=type=secret,id=ATB_NEXT_PUBLIC_MAPBOX_API_TOKEN \ --mount=type=secret,id=ATB_NEXT_PUBLIC_MAPBOX_STOP_PLACES_STYLE_URL \ @@ -75,6 +80,7 @@ ENV NEXT_PUBLIC_FIREBASE_PUBLIC_API_KEY=$NFK_NEXT_PUBLIC_FIREBASE_PUBLIC_API_KEY ENV NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=$NFK_NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN ENV NEXT_PUBLIC_FIREBASE_APP_ID=$NFK_NEXT_PUBLIC_FIREBASE_APP_ID ENV NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID=$NFK_NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID +ENV NEXT_PUBLIC_IN_STAGING=$NFK_NEXT_PUBLIC_IN_STAGING RUN --mount=type=secret,id=NFK_NEXT_PUBLIC_MAPBOX_API_TOKEN \ --mount=type=secret,id=NFK_NEXT_PUBLIC_MAPBOX_STOP_PLACES_STYLE_URL \ @@ -91,6 +97,7 @@ ENV NEXT_PUBLIC_FIREBASE_PUBLIC_API_KEY=$FRAM_NEXT_PUBLIC_FIREBASE_PUBLIC_API_KE ENV NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=$FRAM_NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN ENV NEXT_PUBLIC_FIREBASE_APP_ID=$FRAM_NEXT_PUBLIC_FIREBASE_APP_ID ENV NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID=$FRAM_NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID +ENV NEXT_PUBLIC_IN_STAGING=$FRAM_NEXT_PUBLIC_IN_STAGING RUN --mount=type=secret,id=FRAM_NEXT_PUBLIC_MAPBOX_API_TOKEN \ --mount=type=secret,id=FRAM_NEXT_PUBLIC_MAPBOX_STOP_PLACES_STYLE_URL \ @@ -107,6 +114,7 @@ ENV NEXT_PUBLIC_FIREBASE_PUBLIC_API_KEY=$TROMS_NEXT_PUBLIC_FIREBASE_PUBLIC_API_K ENV NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=$TROMS_NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN ENV NEXT_PUBLIC_FIREBASE_APP_ID=$TROMS_NEXT_PUBLIC_FIREBASE_APP_ID ENV NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID=$TROMS_NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID +ENV NEXT_PUBLIC_IN_STAGING=$TROMS_NEXT_PUBLIC_IN_STAGING RUN --mount=type=secret,id=TROMS_NEXT_PUBLIC_MAPBOX_API_TOKEN \ --mount=type=secret,id=TROMS_NEXT_PUBLIC_MAPBOX_STOP_PLACES_STYLE_URL \ diff --git a/next-sitemap.js b/next-sitemap.js index 9b34bf77..57d702d4 100644 --- a/next-sitemap.js +++ b/next-sitemap.js @@ -1,16 +1,24 @@ /** @type {import('next-sitemap').IConfig} */ -function getSiteUrl() { +function getEnvironmentUrls() { const orgId = process.env.NEXT_PUBLIC_PLANNER_ORG_ID; const org = require(`./orgs/${orgId}.json`); - return org.urls.travelPlannerUrl.href; + return org.urls.sitemapUrls; } -const siteUrl = getSiteUrl(); -const prod = process.env.NODE_ENV === 'production'; +const environmentUrls = getEnvironmentUrls(); + +let environment; +if (process.env.NEXT_PUBLIC_IN_STAGING) { + environment = 'staging'; +} else if (!process.env.NEXT_PUBLIC_IN_STAGING) { + environment = 'prod'; +} else { + environment = 'dev'; +} module.exports = { - siteUrl: prod ? siteUrl : 'http://localhost:3000', + siteUrl: environmentUrls[environment], generateIndexSitemap: false, sitemapSize: 7000, generateRobotsTxt: true, diff --git a/orgs/atb.json b/orgs/atb.json index 2d3e0524..59d86922 100644 --- a/orgs/atb.json +++ b/orgs/atb.json @@ -36,8 +36,10 @@ "no": "https://www.atb.no/priser/", "default": "https://www.atb.no/priser/" }, - "travelPlannerUrl": { - "href": "https://reise.atb.no/" + "sitemapUrls": { + "dev": "http://localhost:3000", + "staging": "https://atb-staging.planner-web.mittatb.no/", + "prod": "https://reise.atb.no/" } }, "journeyApiConfigurations": { diff --git a/orgs/fram.json b/orgs/fram.json index 1ed69168..3db04595 100644 --- a/orgs/fram.json +++ b/orgs/fram.json @@ -35,8 +35,10 @@ "nn": "https://frammr.no/billettar/billettar-og-prisar/?sprak=11", "default": "https://frammr.no/billettar/billettar-og-prisar/" }, - "travelPlannerUrl": { - "href": "https://reise.frammr.no/" + "sitemapUrls": { + "dev": "http://localhost:3000", + "staging": "https://fram-staging.planner-web.mittatb.no/", + "prod": "https://reise.frammr.no/" } }, "journeyApiConfigurations": { diff --git a/orgs/nfk.json b/orgs/nfk.json index b494a809..62600040 100644 --- a/orgs/nfk.json +++ b/orgs/nfk.json @@ -36,8 +36,10 @@ "no": "https://www.reisnordland.no/priser-pa-buss", "default": "https://www.reisnordland.no/priser-pa-buss" }, - "travelPlannerUrl": { - "href": "https://reise.reisnordland.no/" + "sitemapUrls": { + "dev": "http://localhost:3000", + "staging": "https://nfk-staging.planner-web.mittatb.no/", + "prod": "https://www.reisnordland.no/" } }, "journeyApiConfigurations": { diff --git a/orgs/schema-validation.json b/orgs/schema-validation.json index ac1b40e0..5c059d1c 100644 --- a/orgs/schema-validation.json +++ b/orgs/schema-validation.json @@ -74,9 +74,21 @@ "ticketsUrl": { "$ref": "#/definitions/TranslatableUrl" }, - "travelPlannerUrl": { - "name": { - "type": "string" + "sitemapUrls": { + "dev": { + "name": { + "type": "string" + } + }, + "staging": { + "name": { + "type": "string" + } + }, + "prod": { + "name": { + "type": "string" + } } } }, diff --git a/orgs/troms.json b/orgs/troms.json index 96c0a6fc..d695e1c3 100644 --- a/orgs/troms.json +++ b/orgs/troms.json @@ -36,8 +36,11 @@ "no": "https://fylkestrafikk.no/meny/billetter-og-priser", "default": "https://fylkestrafikk.no/meny/billetter-og-priser" }, - "travelPlannerUrl": { - "href": "https://reise.fylkestrafikk.no/" + + "sitemapUrls": { + "dev": "http://localhost:3000", + "staging": "https://troms-staging.planner-web.mittatb.no/", + "prod": "https://reise.fylkestrafikk.no/" } }, "journeyApiConfigurations": {