diff --git a/docker-compose.yml b/docker-compose.yml index 7ebca88..6ff22dc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,6 +14,8 @@ services: - ADMIN_TOKEN=${ADMIN_TOKEN:-default_insecure_token} - DATA_DIR=/app/data restart: unless-stopped + networks: + - internal_net frontend: build: @@ -26,3 +28,9 @@ services: depends_on: - backend restart: unless-stopped + networks: + - internal_net + +networks: + internal_net: + driver: bridge diff --git a/frontend/src/pages/index.astro b/frontend/src/pages/index.astro index a52c19b..ed0010c 100644 --- a/frontend/src/pages/index.astro +++ b/frontend/src/pages/index.astro @@ -1,7 +1,7 @@ --- import Layout from '../layouts/Layout.astro'; -const API_URL = import.meta.env.PUBLIC_API_URL || 'http://localhost:3000'; +const API_URL = (typeof process !== 'undefined' ? process.env.PUBLIC_API_URL : import.meta.env.PUBLIC_API_URL) || 'http://localhost:3000'; interface Post { slug: string; diff --git a/frontend/src/pages/posts/[slug].astro b/frontend/src/pages/posts/[slug].astro index 585c67c..03ded96 100644 --- a/frontend/src/pages/posts/[slug].astro +++ b/frontend/src/pages/posts/[slug].astro @@ -3,7 +3,7 @@ import Layout from '../../layouts/Layout.astro'; import { marked } from 'marked'; const { slug } = Astro.params; -const API_URL = import.meta.env.PUBLIC_API_URL || 'http://localhost:3000'; +const API_URL = (typeof process !== 'undefined' ? process.env.PUBLIC_API_URL : import.meta.env.PUBLIC_API_URL) || 'http://localhost:3000'; interface PostDetail { slug: string; diff --git a/frontend/src/pages/uploads/[...path].astro b/frontend/src/pages/uploads/[...path].astro index fba467a..1711c19 100644 --- a/frontend/src/pages/uploads/[...path].astro +++ b/frontend/src/pages/uploads/[...path].astro @@ -1,6 +1,6 @@ --- const { path } = Astro.params; -const API_URL = import.meta.env.PUBLIC_API_URL || 'http://localhost:3000'; +const API_URL = (typeof process !== 'undefined' ? process.env.PUBLIC_API_URL : import.meta.env.PUBLIC_API_URL) || 'http://localhost:3000'; const response = await fetch(`${API_URL}/uploads/${path}`);