Skip to content

Commit

Permalink
Working inside docker
Browse files Browse the repository at this point in the history
  • Loading branch information
eyeseast committed Feb 2, 2024
1 parent e942ec0 commit 5dfb266
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
9 changes: 6 additions & 3 deletions local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,25 @@ services:
- nodemodules:/app/node_modules
- .:/app
working_dir: /app
command: npm run watch
command: npm run dev
networks:
default:
aliases:
- internal.www.dev.documentcloud.org
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
volumes:
- nodemodules:/app/node_modules
- .:/app
working_dir: /app
command: npm run dev-app
command: npm run dev
networks:
default:
aliases:
Expand All @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions src/hooks.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}

Expand Down
1 change: 1 addition & 0 deletions src/routes/[...path]/+page.js
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
6 changes: 6 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}"],
},
Expand Down

0 comments on commit 5dfb266

Please sign in to comment.