Skip to content

Commit

Permalink
feat: add internal proxy support for PB API calls; add URLs enum; upd…
Browse files Browse the repository at this point in the history
…ate 'ORIGIN' env handling

Signed-off-by: Robert Goniszewski <robertgoniszewski@outlook.com>
  • Loading branch information
goniszewski committed Mar 28, 2024
1 parent bf99cd3 commit 501a78b
Show file tree
Hide file tree
Showing 10 changed files with 482 additions and 25 deletions.
8 changes: 4 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Set it if you're using external PocketBase installation (default: http://localhost:8090)
# Set it if you're using external PocketBase installation (default: http://pocketbase)
# Example: PUBLIC_POCKETBASE_URL=https://grimoire.mydomain.com:8090
PUBLIC_POCKETBASE_URL=http://localhost:8090
PUBLIC_POCKETBASE_URL=
# RECOMMENDED: Change this to your email
ROOT_ADMIN_EMAIL=admin@grimoire.localhost
# RECOMMENDED: Use a secure password. Can be later changed in PocketBase's admin panel
ROOT_ADMIN_PASSWORD=changeme
# Set this to your domain name (default: http://localhost:5173)
# Example: ORIGIN=grimoire.mydomain.com
ORIGIN=http://localhost:5173
# Example: PUBLIC_ORIGIN=grimoire.mydomain.com
PUBLIC_ORIGIN=http://localhost:5173
# Set this to true if you're using HTTPS (default: false)
# Example: PUBLIC_HTTPS_ONLY=true
PUBLIC_HTTPS_ONLY=
Expand Down
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,25 @@ FROM base
ARG PUBLIC_POCKETBASE_URL
ARG ROOT_ADMIN_EMAIL
ARG ROOT_ADMIN_PASSWORD
ARG ORIGIN="http://localhost:5173"
ARG PUBLIC_ORIGIN="http://localhost:5173"
ARG PORT=5173
ARG PUBLIC_HTTPS_ONLY="false"
ARG PUBLIC_SIGNUP_DISABLED="false"
ARG BODY_SIZE_LIMIT="5000000"

ENV PUBLIC_POCKETBASE_URL=$PUBLIC_POCKETBASE_URL
ENV ROOT_ADMIN_EMAIL=$ROOT_ADMIN_EMAIL
ENV ROOT_ADMIN_PASSWORD=$ROOT_ADMIN_PASSWORD
ENV ORIGIN=$ORIGIN
ENV PUBLIC_ORIGIN=$PUBLIC_ORIGIN
ENV ORIGIN=$PUBLIC_ORIGIN
ENV PORT=$PORT
ENV PUBLIC_HTTPS_ONLY=$PUBLIC_HTTPS_ONLY
ENV PUBLIC_SIGNUP_DISABLED=$PUBLIC_SIGNUP_DISABLED
ENV BODY_SIZE_LIMIT=$BODY_SIZE_LIMIT

COPY --from=prod-deps /app/node_modules /app/node_modules
COPY --from=build /app/build /app/build
COPY --from=build /app/package.json /app/package.json
ENV NODE_ENV=production
EXPOSE $PORT
CMD [ "node", "-r", "dotenv/config", "build" ]
CMD [ "node", "-r", "dotenv/config", "src/server.js" ]
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
"@sveltejs/kit": "^2.5.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"@tailwindcss/typography": "^0.5.10",
"@types/express": "^4.17.21",
"@types/express-http-proxy": "^1.6.6",
"@types/swagger-ui": "^3.52.4",
"@typescript-eslint/eslint-plugin": "^6.20.0",
"@typescript-eslint/parser": "^6.20.0",
Expand Down Expand Up @@ -65,6 +67,8 @@
"@types/sanitize-html": "^2.9.5",
"daisyui": "^4.6.1",
"dotenv": "^16.4.1",
"express": "^4.19.2",
"express-http-proxy": "^2.0.0",
"fuse.js": "^7.0.0",
"html-to-text": "^9.0.5",
"joi": "^17.12.1",
Expand Down
Loading

0 comments on commit 501a78b

Please sign in to comment.