diff --git a/README.md b/README.md index 97cc73f..d0b6004 100644 --- a/README.md +++ b/README.md @@ -9,3 +9,11 @@ rendered front-end. npm install npm run watch ``` + +## Running on a custom port + +``` +export SEALIOUS_PORT=8888 +export SEALIOUS_BASE_URL="https://888.dep.sealcode.org" +npm run watch +``` diff --git a/package.json b/package.json index db8702f..eb8451c 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "build": "npm run build:back && npm run build:front", "watch:back": "tsc --watch -p src/back", "watch:front": "webpack --watch", - "watch": "tmux new-session -d \"printf '\\033]2;%s\\033\\' 'watch:back' && npm run watch:back\" && tmux split-window -d \"printf '\\033]2;%s\\033\\' 'server' && nodemon .\" && tmux split-window -d \"printf '\\033]2;%s\\033\\' 'watch:front' && npm run watch:front\" && tmux select-layout even-horizontal && tmux set -g pane-border-status top && tmux attach", + "watch": "tmux new-session -d \"printf '\\033]2;%s\\033\\' 'watch:back' && npm run watch:back\" && tmux split-window -d \"printf '\\033]2;%s\\033\\' 'server' && SEALIOUS_PORT=$SEALIOUS_PORT SEALIOUS_BASE_URL=$SEALIOUS_BASE_URL nodemon .\" && tmux split-window -d \"printf '\\033]2;%s\\033\\' 'watch:front' && npm run watch:front\" && tmux select-layout even-horizontal && tmux set -g pane-border-status top && tmux attach", "test-reports": "npm run build && rm -fr .xunit coverage && docker-compose up -d db mailcatcher && npm run test -- --cover --test-report", "cover-html": "npm run test-reports -- --cover-html && xdg-open coverage/lcov-report/index.html" }, diff --git a/src/back/app.ts b/src/back/app.ts index 796478d..fef92f0 100644 --- a/src/back/app.ts +++ b/src/back/app.ts @@ -4,6 +4,13 @@ import { App } from "sealious"; import tasks from "./collections/tasks"; const locreq = _locreq(__dirname); +const PORT = process.env.SEALIOUS_PORT + ? parseInt(process.env.SEALIOUS_PORT) + : 8080; +const base_url = process.env.SEALIOUS_BASE_URL || `http://localhost:${PORT}`; + +console.log(process.env); + export default class TheApp extends App { config = { upload_path: locreq.resolve("uploaded_files"), @@ -19,13 +26,16 @@ export default class TheApp extends App { logger: { level: "info", }, + "www-server": { + port: PORT, + }, }; manifest = { name: "Sealious Playground", logo: resolve(__dirname, "../assets/logo.png"), version: "0.0.1", default_language: "en", - base_url: "localhost:8080", + base_url, admin_email: "admin@example.com", colors: { primary: "#5294a1",