fix: geocoder/worker network + CORS configurable par env
- Ajoute geocoder-worker et worker sur le réseau coolify pour résoudre le hostname DB (lgrep99...) qui n'est accessible que depuis le réseau coolify - CORS_ORIGINS env var optionnel pour configurer les origines autorisées (utilisé par l'env dev) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
d1a6a6bc27
commit
06a5bf2ef8
1 changed files with 3 additions and 1 deletions
|
|
@ -20,7 +20,9 @@ await fastify.register(helmet, {
|
||||||
// CORS middleware
|
// CORS middleware
|
||||||
fastify.addHook('onRequest', async (request, reply) => {
|
fastify.addHook('onRequest', async (request, reply) => {
|
||||||
const origin = request.headers.origin;
|
const origin = request.headers.origin;
|
||||||
const allowedOrigins = ['https://metalfrom.eu', 'https://www.metalfrom.eu'];
|
const allowedOrigins = process.env.CORS_ORIGINS
|
||||||
|
? process.env.CORS_ORIGINS.split(',').map(s => s.trim())
|
||||||
|
: ['https://metalfrom.eu', 'https://www.metalfrom.eu'];
|
||||||
|
|
||||||
if (allowedOrigins.includes(origin)) {
|
if (allowedOrigins.includes(origin)) {
|
||||||
reply.header('Access-Control-Allow-Origin', origin);
|
reply.header('Access-Control-Allow-Origin', origin);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue