Expose externally
This commit is contained in:
+2
-2
@@ -3,8 +3,8 @@ import { defineConfig } from 'astro/config';
|
||||
export default defineConfig({
|
||||
output: 'static',
|
||||
trailingSlash: 'always',
|
||||
site: process.env.PUBLIC_SITE_URL ?? 'https://swansea-airport.wales',
|
||||
site: process.env.PUBLIC_SITE_URL ?? 'https://egfhtest.pattinson.org',
|
||||
server: {
|
||||
allowedHosts: ['docker', 'localhost'],
|
||||
allowedHosts: ['docker', 'docker.pattinson.org', 'localhost', 'egfhtest.pattinson.org'],
|
||||
},
|
||||
});
|
||||
|
||||
+12
-4
@@ -38,13 +38,15 @@ services:
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
ports:
|
||||
- "${DIRECTUS_PORT}:8055"
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
volumes:
|
||||
- directus_uploads:/directus/uploads
|
||||
networks:
|
||||
- default
|
||||
- webapps
|
||||
|
||||
|
||||
directus-bootstrap:
|
||||
image: node:22-alpine
|
||||
@@ -79,16 +81,22 @@ services:
|
||||
directus-bootstrap:
|
||||
condition: service_completed_successfully
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "${FRONTEND_PORT}:80"
|
||||
volumes:
|
||||
- ./:/app
|
||||
- ./public/images:/app/public/images
|
||||
- web_node_modules:/app/node_modules
|
||||
- web_astro:/app/.astro
|
||||
networks:
|
||||
- default
|
||||
- webapps
|
||||
|
||||
volumes:
|
||||
db_data:
|
||||
directus_uploads:
|
||||
web_node_modules:
|
||||
web_astro:
|
||||
|
||||
networks:
|
||||
default:
|
||||
webapps:
|
||||
external: true
|
||||
@@ -16,18 +16,23 @@ function resolveEventImageSource(realimage: EventItem['realimage']): string | nu
|
||||
const candidate = typeof realimage === 'string' ? realimage : realimage.id;
|
||||
if (!candidate) return null;
|
||||
|
||||
if (candidate.startsWith('http://') || candidate.startsWith('https://') || candidate.startsWith('/')) {
|
||||
return candidate;
|
||||
}
|
||||
|
||||
const configuredPublicUrl = process.env.DIRECTUS_PUBLIC_URL;
|
||||
const configuredDirectusPublicUrl = process.env.DIRECTUS_PUBLIC_URL;
|
||||
const directusPort = process.env.DIRECTUS_PORT ?? '8066';
|
||||
const localFallbackUrl = `${Astro.url.protocol}//${Astro.url.hostname}:${directusPort}`;
|
||||
const directusBaseUrl =
|
||||
configuredPublicUrl && !configuredPublicUrl.includes('example.com')
|
||||
? configuredPublicUrl
|
||||
configuredDirectusPublicUrl && !configuredDirectusPublicUrl.includes('example.com')
|
||||
? configuredDirectusPublicUrl
|
||||
: localFallbackUrl;
|
||||
|
||||
if (candidate.startsWith('/')) {
|
||||
return new URL(candidate, directusBaseUrl).toString();
|
||||
}
|
||||
|
||||
if (candidate.startsWith('http://') || candidate.startsWith('https://')) {
|
||||
const candidateUrl = new URL(candidate);
|
||||
return candidateUrl.pathname.startsWith('/assets/') ? new URL(candidateUrl.pathname, directusBaseUrl).toString() : candidate;
|
||||
}
|
||||
|
||||
return new URL(`/assets/${candidate}`, directusBaseUrl).toString();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user