diff --git a/local.yml b/local.yml index f108da7f6..0672f088b 100644 --- a/local.yml +++ b/local.yml @@ -7,7 +7,7 @@ services: - nodemodules:/app/node_modules - .:/app working_dir: /app - command: npm run watch + command: npm run dev networks: default: aliases: @@ -15,6 +15,9 @@ services: squarelet_default: aliases: - internal.www.dev.documentcloud.org + environment: + DOCKER: true + NODE_TLS_REJECT_UNAUTHORIZED: 0 # todo: solve local certificate chain issues documentcloud_frontend_app: image: node:18 @@ -22,7 +25,7 @@ services: - nodemodules:/app/node_modules - .:/app working_dir: /app - command: npm run dev-app + command: npm run dev networks: default: aliases: @@ -37,7 +40,7 @@ services: - nodemodules:/app/node_modules - .:/app working_dir: /app - command: npm run dev-embed + command: npm run dev networks: default: aliases: diff --git a/src/hooks.server.ts b/src/hooks.server.ts index 091c17002..5177a999c 100644 --- a/src/hooks.server.ts +++ b/src/hooks.server.ts @@ -14,6 +14,8 @@ export async function handle({ event, resolve }) { /** @type {import('@sveltejs/kit').HandleFetch} */ export async function handleFetch({ event, request, fetch }) { if (request.url.startsWith(DC_BASE)) { + // handle docker issues + event.url.protocol = "https"; request.headers.set("cookie", event.request.headers.get("cookie")); } diff --git a/src/routes/[...path]/+page.js b/src/routes/[...path]/+page.js index 0c654f153..a624a7fcf 100644 --- a/src/routes/[...path]/+page.js +++ b/src/routes/[...path]/+page.js @@ -1,4 +1,5 @@ // load data for flatpages +import { browser } from "$app/environment"; import { error, redirect } from "@sveltejs/kit"; import { marked } from "marked"; import { gfmHeadingId } from "marked-gfm-heading-id"; diff --git a/vite.config.js b/vite.config.js index 1d25f196f..a1bf96a69 100644 --- a/vite.config.js +++ b/vite.config.js @@ -26,6 +26,12 @@ export default defineConfig({ }, }, + server: { + host: "0.0.0.0", + port: process.env.DOCKER ? 80 : 5173, + origin: "https://www.dev.documentcloud.org", + }, + test: { include: ["src/**/*.{test,spec}.{js,ts}"], },