mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 18:41:08 +02:00
🐛 fix(staging): add missing PUBLIC_*_CLIENT env vars for runtime config
Web apps use hooks.server.ts to inject window.__PUBLIC_*__ variables at runtime, but docker-compose.staging.yml was only setting vars for docker-entrypoint.sh config.json. This caused web apps to fall back to localhost URLs in production. Changes: - Add PUBLIC_*_CLIENT env vars for all staging web apps - Update calendar-web hooks.server.ts to inject contacts API URL
This commit is contained in:
parent
2784143466
commit
834b11d1d1
2 changed files with 27 additions and 10 deletions
|
|
@ -11,6 +11,8 @@ const PUBLIC_MANA_CORE_AUTH_URL_CLIENT =
|
|||
process.env.PUBLIC_MANA_CORE_AUTH_URL_CLIENT || process.env.PUBLIC_MANA_CORE_AUTH_URL || '';
|
||||
const PUBLIC_BACKEND_URL_CLIENT =
|
||||
process.env.PUBLIC_BACKEND_URL_CLIENT || process.env.PUBLIC_BACKEND_URL || '';
|
||||
const PUBLIC_CONTACTS_API_URL_CLIENT =
|
||||
process.env.PUBLIC_CONTACTS_API_URL_CLIENT || process.env.PUBLIC_CONTACTS_API_URL || '';
|
||||
|
||||
export const handle: Handle = async ({ event, resolve }) => {
|
||||
return resolve(event, {
|
||||
|
|
@ -20,6 +22,7 @@ export const handle: Handle = async ({ event, resolve }) => {
|
|||
const envScript = `<script>
|
||||
window.__PUBLIC_MANA_CORE_AUTH_URL__ = "${PUBLIC_MANA_CORE_AUTH_URL_CLIENT}";
|
||||
window.__PUBLIC_BACKEND_URL__ = "${PUBLIC_BACKEND_URL_CLIENT}";
|
||||
window.__PUBLIC_CONTACTS_API_URL__ = "${PUBLIC_CONTACTS_API_URL_CLIENT}";
|
||||
</script>`;
|
||||
return html.replace('<head>', `<head>${envScript}`);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -148,10 +148,12 @@ services:
|
|||
environment:
|
||||
NODE_ENV: staging
|
||||
PORT: 3000
|
||||
# Runtime config generation (12-factor pattern)
|
||||
# These vars are used by docker-entrypoint.sh to generate /config.json
|
||||
# Runtime config - for docker-entrypoint.sh (/config.json)
|
||||
BACKEND_URL: https://chat-api.staging.manacore.ai
|
||||
AUTH_URL: https://auth.staging.manacore.ai
|
||||
# Runtime config - for hooks.server.ts (window.__PUBLIC_*__ injection)
|
||||
PUBLIC_MANA_CORE_AUTH_URL_CLIENT: https://auth.staging.manacore.ai
|
||||
PUBLIC_BACKEND_URL_CLIENT: https://chat-api.staging.manacore.ai
|
||||
ports:
|
||||
- "3000:3000"
|
||||
healthcheck:
|
||||
|
|
@ -182,8 +184,7 @@ services:
|
|||
environment:
|
||||
NODE_ENV: staging
|
||||
PORT: 5173
|
||||
# Runtime config generation (12-factor pattern)
|
||||
# These vars are used by docker-entrypoint.sh to generate /config.json
|
||||
# Runtime config - for docker-entrypoint.sh (/config.json)
|
||||
API_BASE_URL: https://staging.manacore.ai
|
||||
AUTH_URL: https://auth.staging.manacore.ai
|
||||
TODO_API_URL: https://todo-api.staging.manacore.ai
|
||||
|
|
@ -191,6 +192,12 @@ services:
|
|||
CLOCK_API_URL: https://clock-api.staging.manacore.ai
|
||||
CONTACTS_API_URL: https://contacts-api.staging.manacore.ai
|
||||
PICTURE_API_URL: https://picture-api.staging.manacore.ai
|
||||
# Runtime config - for hooks.server.ts (window.__PUBLIC_*__ injection)
|
||||
PUBLIC_MANA_CORE_AUTH_URL_CLIENT: https://auth.staging.manacore.ai
|
||||
PUBLIC_TODO_API_URL_CLIENT: https://todo-api.staging.manacore.ai
|
||||
PUBLIC_CALENDAR_API_URL_CLIENT: https://calendar-api.staging.manacore.ai
|
||||
PUBLIC_CLOCK_API_URL_CLIENT: https://clock-api.staging.manacore.ai
|
||||
PUBLIC_CONTACTS_API_URL_CLIENT: https://contacts-api.staging.manacore.ai
|
||||
ports:
|
||||
- "5173:5173"
|
||||
healthcheck:
|
||||
|
|
@ -323,12 +330,15 @@ services:
|
|||
environment:
|
||||
NODE_ENV: staging
|
||||
PORT: 5186
|
||||
# Runtime config generation (12-factor pattern)
|
||||
# These vars are used by docker-entrypoint.sh to generate /config.json
|
||||
# Runtime config - for docker-entrypoint.sh (/config.json)
|
||||
BACKEND_URL: https://calendar-api.staging.manacore.ai
|
||||
AUTH_URL: https://auth.staging.manacore.ai
|
||||
TODO_API_URL: https://todo-api.staging.manacore.ai
|
||||
CONTACTS_API_URL: https://contacts-api.staging.manacore.ai
|
||||
# Runtime config - for hooks.server.ts (window.__PUBLIC_*__ injection)
|
||||
PUBLIC_MANA_CORE_AUTH_URL_CLIENT: https://auth.staging.manacore.ai
|
||||
PUBLIC_BACKEND_URL_CLIENT: https://calendar-api.staging.manacore.ai
|
||||
PUBLIC_CONTACTS_API_URL_CLIENT: https://contacts-api.staging.manacore.ai
|
||||
ports:
|
||||
- "5186:5186"
|
||||
healthcheck:
|
||||
|
|
@ -393,10 +403,12 @@ services:
|
|||
environment:
|
||||
NODE_ENV: staging
|
||||
PORT: 5187
|
||||
# Runtime config generation (12-factor pattern)
|
||||
# These vars are used by docker-entrypoint.sh to generate /config.json
|
||||
# Runtime config - for docker-entrypoint.sh (/config.json)
|
||||
API_BASE_URL: https://clock-api.staging.manacore.ai
|
||||
AUTH_URL: https://auth.staging.manacore.ai
|
||||
# Runtime config - for hooks.server.ts (window.__PUBLIC_*__ injection)
|
||||
PUBLIC_MANA_CORE_AUTH_URL_CLIENT: https://auth.staging.manacore.ai
|
||||
PUBLIC_BACKEND_URL_CLIENT: https://clock-api.staging.manacore.ai
|
||||
ports:
|
||||
- "5187:5187"
|
||||
healthcheck:
|
||||
|
|
@ -472,10 +484,12 @@ services:
|
|||
environment:
|
||||
NODE_ENV: staging
|
||||
PORT: 5175
|
||||
# Runtime config generation (12-factor pattern)
|
||||
# These vars are used by docker-entrypoint.sh to generate /config.json
|
||||
# Runtime config - for docker-entrypoint.sh (/config.json)
|
||||
BACKEND_URL: https://picture-api.staging.manacore.ai
|
||||
AUTH_URL: https://auth.staging.manacore.ai
|
||||
# Runtime config - for hooks.server.ts (window.__PUBLIC_*__ injection)
|
||||
PUBLIC_MANA_CORE_AUTH_URL_CLIENT: https://auth.staging.manacore.ai
|
||||
PUBLIC_BACKEND_URL_CLIENT: https://picture-api.staging.manacore.ai
|
||||
ports:
|
||||
- "5175:5175"
|
||||
healthcheck:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue