Skip to content

Commit

Permalink
Merge pull request #1767 from BaseAdresseNationale/fix/toggler-data-s…
Browse files Browse the repository at this point in the history
…ource-for-s3

Fix:  S3 env config variables are not loaded on build
  • Loading branch information
nkokla authored Jun 13, 2024
2 parents 0109ccf + 01320a5 commit 9bfb3a3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .env.default
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ S3_CONFIG_REGION=
S3_CONFIG_ENDPOINT=

# Connexion au Dossier Data local (en cas de rollback - TOGGLER_DATA_SOURCES=local sinon TOGGLER_DATA_SOURCES=S3)
TOGGLER_DATA_SOURCES=S3
PATH_STATIC_FILE=
NEXT_PUBLIC_TOGGLER_DATA_SOURCES=S3
NEXT_PUBLIC_PATH_STATIC_FILE=
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@ services:
- API_DEPOT_TOKEN=${API_DEPOT_TOKEN}
- SESSION_SECRET=${SESSION_SECRET}
- NEXT_PUBLIC_CERTIFICAT_NUMEROTATION_ENABLED=${NEXT_PUBLIC_CERTIFICAT_NUMEROTATION_ENABLED}
- PATH_STATIC_FILE=${PATH_STATIC_FILE}
- GHOST_KEY=${GHOST_KEY}
- NEXT_PUBLIC_GHOST_URL=${NEXT_PUBLIC_GHOST_URL}
- NEXT_PUBLIC_GHOST_URL_IMAGES_SOURCE=${NEXT_PUBLIC_GHOST_URL_IMAGES_SOURCE}
- NEXT_PUBLIC_BAL_ADMIN_API_URL=${NEXT_PUBLIC_BAL_ADMIN_API_URL}
- NEXT_PUBLIC_BAL_API_URL=${NEXT_PUBLIC_BAL_API_URL}
- NEXT_PUBLIC_BAL_WIDGET_URL=${NEXT_PUBLIC_BAL_WIDGET_URL}
- NEXT_PUBLIC_MES_ADRESSES=${NEXT_PUBLIC_MES_ADRESSES}
- NEXT_PUBLIC_TOGGLER_DATA_SOURCES=${NEXT_PUBLIC_TOGGLER_DATA_SOURCES}
- NEXT_PUBLIC_PATH_STATIC_FILE=${NEXT_PUBLIC_PATH_STATIC_FILE}
- S3_CONFIG_ACCESS_KEY_ID=${S3_CONFIG_ACCESS_KEY_ID}
- S3_CONFIG_SECRET_ACCESS_KEY=${S3_CONFIG_SECRET_ACCESS_KEY}
- S3_CONFIG_REGION=${S3_CONFIG_REGION}
Expand Down
6 changes: 3 additions & 3 deletions pages/data/[[...path]].js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import DataPageLegacy, {getServerSideProps as getServerSidePropsLegacy} from './data-legacy'
import DataPageS3, {getServerSideProps as getServerSidePropsS3} from './data-s3'

const {TOGGLER_DATA_SOURCES} = process.env
const getServerSideProps = TOGGLER_DATA_SOURCES === 'S3' ? getServerSidePropsS3 : getServerSidePropsLegacy
const DataPage = TOGGLER_DATA_SOURCES === 'S3' ? DataPageS3 : DataPageLegacy
const {NEXT_PUBLIC_TOGGLER_DATA_SOURCES} = process.env
const getServerSideProps = NEXT_PUBLIC_TOGGLER_DATA_SOURCES === 'S3' ? getServerSidePropsS3 : getServerSidePropsLegacy
const DataPage = NEXT_PUBLIC_TOGGLER_DATA_SOURCES === 'S3' ? DataPageS3 : DataPageLegacy

export {getServerSideProps}
export default DataPage
2 changes: 1 addition & 1 deletion pages/data/data-legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import sendToTracker, {getDownloadToEventTracker} from '@/lib/util/analytics-tra

import ErrorPage from '../_error'

const PATH = process.env.PATH_STATIC_FILE
const PATH = process.env.NEXT_PUBLIC_PATH_STATIC_FILE
const rootLink = {
href: '/donnees-nationales',
label: 'Données nationales',
Expand Down

0 comments on commit 9bfb3a3

Please sign in to comment.