Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tech] Correction de la messagerie (UPDATE ENV VAR) #3029

Merged
merged 4 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions frontend/.env.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
################################################################################
# Chat

# We need to use a VITE_ env var to replace the HTML index file
# see: https://vitejs.dev/guide/env-and-mode.html#html-env-replacement
VITE_SMALL_CHAT_SNIPPET=
FRONTEND_SMALL_CHAT_SNIPPET=

################################################################################
# Feature flags
Expand Down
2 changes: 1 addition & 1 deletion frontend/.env.local.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# We need to use a VITE_ env var to replace the HTML index file
# see: https://vitejs.dev/guide/env-and-mode.html#html-env-replacement
VITE_SMALL_CHAT_SNIPPET=
FRONTEND_SMALL_CHAT_SNIPPET=

################################################################################
# Feature flags
Expand Down
2 changes: 1 addition & 1 deletion frontend/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ beforeEach(() => {
}
)

// PROD :: VITE_SMALL_CHAT_SNIPPET
// PROD :: FRONTEND_SMALL_CHAT_SNIPPET
cy.intercept(
{ url: /^https:\/\/embed\.small\.chat\/.*/ },
{
Expand Down
4 changes: 0 additions & 4 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>

<!-- We need to use a VITE_ env var to replace the HTML index file -->
<!-- see: https://vitejs.dev/guide/env-and-mode.html#html-env-replacement -->
%VITE_SMALL_CHAT_SNIPPET%

<!-- This script will be used by the `import-meta-env` library to inject -->
<!-- runtime environment variables when running in production -->
<!-- see: https://import-meta-env.org/guide/getting-started/introduction.html -->
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ export function App({ auth }: AppProps) {
</AuthorizationContext.Provider>
</FrontendErrorBoundary>
</RsuiteCustomProvider>
{/* This script is used to inject the chat */}
{import.meta.env.FRONTEND_SMALL_CHAT_SNIPPET && (
<script async src={import.meta.env.FRONTEND_SMALL_CHAT_SNIPPET} />
)}
</ThemeProvider>
)
}
1 change: 1 addition & 0 deletions frontend/src/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ interface ImportMetaEnv {
readonly FRONTEND_OIDC_REDIRECT_URI: string
readonly FRONTEND_SENTRY_DSN?: string
readonly FRONTEND_SHOM_KEY: string
readonly FRONTEND_SMALL_CHAT_SNIPPET: string
}

interface ImportMeta {
Expand Down
3 changes: 0 additions & 3 deletions infra/configurations/frontend/.env.prod

This file was deleted.

2 changes: 1 addition & 1 deletion infra/docker/docker-compose.cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ services:
- FRONTEND_OIDC_REDIRECT_URI=https://monitorfish.din.developpement-durable.gouv.fr
- FRONTEND_SENTRY_DSN=https://[email protected]/8
- FRONTEND_SHOM_KEY=rg8ele7cft4ujkwjspsmtwas
- VITE_SMALL_CHAT_SNIPPET=
- FRONTEND_MISSION_FORM_AUTO_SAVE_ENABLED=true # Even if we inject this env var, the value is not used (see cypress.config.ts)
- FRONTEND_MISSION_FORM_AUTO_UPDATE_ENABLED=true
- FRONTEND_SMALL_CHAT_SNIPPET=
ports:
- 8880:8880
- 8000:8000
Expand Down
2 changes: 1 addition & 1 deletion infra/docker/docker-compose.puppeteer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ services:
- FRONTEND_OIDC_REDIRECT_URI=https://monitorfish.din.developpement-durable.gouv.fr
- FRONTEND_SENTRY_DSN=https://[email protected]/8
- FRONTEND_SHOM_KEY=rg8ele7cft4ujkwjspsmtwas
- VITE_SMALL_CHAT_SNIPPET=
- FRONTEND_MISSION_FORM_AUTO_SAVE_ENABLED=true
- FRONTEND_MISSION_FORM_AUTO_UPDATE_ENABLED=true
- FRONTEND_SMALL_CHAT_SNIPPET=
ports:
- 8880:8880
- 8000:8000
Expand Down
1 change: 1 addition & 0 deletions infra/remote/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ services:
- FRONTEND_OIDC_ENABLED=$MONITORFISH_OIDC_ENABLED
- MONITORFISH_OIDC_ENABLED=$MONITORFISH_OIDC_ENABLED
- MONITORFISH_API_PROTECTED_API_KEY=$MONITORFISH_API_PROTECTED_API_KEY
- FRONTEND_SMALL_CHAT_SNIPPET=
ports:
- 8880:8880
- 8000:8000
Expand Down
Loading