From d61d69bf83350f1d346fffc13929103f2988f751 Mon Sep 17 00:00:00 2001 From: mrjvs Date: Wed, 12 Aug 2026 12:17:12 +0200 Subject: [PATCH] feat: document configuration + add example.env --- README.md | 54 ++++++++++++++++++++++++++++++++++++++++++++------ example.env | 44 ++++++++++++++++++++++++++++++++++++++++ nuxt.config.ts | 4 ++-- 3 files changed, 94 insertions(+), 8 deletions(-) create mode 100644 example.env diff --git a/README.md b/README.md index 531ed8c..8de7a6d 100644 --- a/README.md +++ b/README.md @@ -6,18 +6,60 @@ This repository contains the source code for [our website](https://pretendo.netw Prerequisites: - Clone the repository +- Have Docker Desktop installed (or Docker engine) - Have NodeJS 24 or higher installed -Run the following in your terminal: -```bash -npm i -npm run dev -``` +Then follow these steps: +- Run `docker compose up -d` inside `/.docker` +- Create a file called `.env` in the root, fill it with the contents of `example.env` +- Install dependencies with `npm i` +- Run the app with `npm run dev` # Translation If you'd like to help localize Pretendo Network, you can contribute to the translations on our project on [Weblate](https://hosted.weblate.org/engage/pretendonetwork/). +# Configuration + +The application can be configured with environment variables. `.env` files are available for development. +There are no fully required configuration variables, the app can runs minimally without any configuration: + +| Feature | Variable | Description | Default | +| ---------------------------- | -------------------------------------- | --------------------------------------------- | -------------------------- | +| Core | `PN_WEBSITE_PUBLIC_BASE_URL` | Base URL of the app | `https://pretendo.network` | +| | `PN_WEBSITE_PUBLIC_COOKIE_SECURE` | Should Secure be enabled for auth cookies | `true` | +| | | | | +| Authentication | `PN_WEBSITE_GRPC_HOST` | Account server GRPC host + port | - | +| | `PN_WEBSITE_GRPC_API_KEY` | Account server GRPC API key | - | +| | `PN_WEBSITE_API_BASE` | Base URL of the account server | `https://api.pretendo.cc` | +| | `PN_WEBSITE_API_BASE_HOST` | Hostname of the account server | `api.pretendo.cc` | +| | | | | +| Progress tracking | `PN_WEBSITE_GITHUB_API_TOKEN` | Github API token | - | +| | | | | +| Discord | `PN_WEBSITE_DISCORD_BOT_TOKEN` | Discord bot token | - | +| | `PN_WEBSITE_DISCORD_CLIENT_ID` | Discord OAuth client ID | - | +| | `PN_WEBSITE_DISCORD_CLIENT_SECRET` | Discord OAuth client secret | - | +| | `PN_WEBSITE_DISCORD_GUILD_ID` | Discord server ID for role linking | - | +| | `PN_WEBSITE_DISCORD_TESTER_ROLE_ID` | Role to give for tester access | (No role) | +| | `PN_WEBSITE_DISCORD_SUPPORTER_ROLE_ID` | Role to give for supporter access | (No role) | +| | | | | +| Payments | `PN_WEBSITE_STRIPE_SECRET_KEY` | Stripe secret key | - | +| (Requires `discord` feature) | `PN_WEBSITE_STRIPE_NOTIFICATION_EMAIL` | Email address to send stripe notifications to | (No notifications) | +| | `PN_WEBSITE_MONGO_CONNECTION_STRING` | MongoDB connection string for account server | - | +| | `PN_WEBSITE_SMTP_HOST` | Host for the SMTP server | - | +| | `PN_WEBSITE_SMTP_PORT` | Port for the SMTP server | `587` | +| | `PN_WEBSITE_SMTP_SECURE` | Use a secure SMTP connection | `true` | +| | `PN_WEBSITE_SMTP_USER` | Username for the SMTP server | (No SMTP auth) | +| | `PN_WEBSITE_SMTP_PASSWORD` | Password for the SMTP server | (No SMTP auth) | +| | `PN_WEBSITE_SMTP_FROM_EMAIL` | Email to sent emails from | - | +| | `PN_WEBSITE_SMTP_FROM_NAME` | Display of the FROM email adress | - | +| | | | | +| Captcha | `PN_WEBSITE_HCAPTCHA_SECRET_KEY` | HCaptcha secret key | - | +| | `PN_WEBSITE_PUBLIC_HCAPTCHA_SITE_KEY` | HCaptcha site key | - | +| | | | | +| Discourse SSO | `PN_WEBSITE_DISCOURSE_SSO_SECRET` | Discourse SSO secret | - | + + # Website refactor The website is currently in a refactor, here is what is still left on the frontend: @@ -55,4 +97,4 @@ And the tasks left on the backend: Miscellanous tasks: - [x] Merge upstream changes into refactor branch - [ ] Security testing -- [ ] Document configuration +- [x] Document configuration diff --git a/example.env b/example.env new file mode 100644 index 0000000..c46192f --- /dev/null +++ b/example.env @@ -0,0 +1,44 @@ +# The defaults in this file are meant for the docker-compose based setup. + +# Core +PN_WEBSITE_PUBLIC_BASE_URL=http://localhost:3000 +PN_WEBSITE_PUBLIC_COOKIE_SECURE=false + +# Optional - Authentication +PN_WEBSITE_GRPC_HOST=localhost:8123 +PN_WEBSITE_GRPC_API_KEY=12345678123456781234567812345678 +PN_WEBSITE_API_BASE=http://localhost:8056 +PN_WEBSITE_API_BASE_HOST=api.pretendo.cc + + +# --- Partially configured features --- +# You will need to fill in some parts in this section before these features start working + +# Optional - Github progress tracking: +PN_WEBSITE_GITHUB_API_TOKEN= + +# Optional - Discord: +PN_WEBSITE_DISCORD_BOT_TOKEN= +PN_WEBSITE_DISCORD_CLIENT_ID= +PN_WEBSITE_DISCORD_CLIENT_SECRET= +PN_WEBSITE_DISCORD_GUILD_ID= +PN_WEBSITE_DISCORD_TESTER_ROLE_ID= +PN_WEBSITE_DISCORD_SUPPORTER_ROLE_ID= + +# Optional - Donation features + rewards (Requires discord): +PN_WEBSITE_STRIPE_SECRET_KEY= +PN_WEBSITE_STRIPE_NOTIFICATION_EMAIL=notifs@example.com +PN_WEBSITE_MONGO_CONNECTION_STRING=mongodb://localhost:27017/account?directConnection=true +PN_WEBSITE_SMTP_HOST=localhost +PN_WEBSITE_SMTP_USER=localhost +PN_WEBSITE_SMTP_PORT=1025 +PN_WEBSITE_SMTP_SECURE=false +PN_WEBSITE_SMTP_FROM_EMAIL=pretendo@example.com +PN_WEBSITE_SMTP_FROM_NAME=Pretendo Network + +# Optional - Captchas: +PN_WEBSITE_HCAPTCHA_SECRET_KEY= +PN_WEBSITE_PUBLIC_HCAPTCHA_SITE_KEY= + +# Optional - Discourse SSO: +PN_WEBSITE_DISCOURSE_SSO_SECRET= diff --git a/nuxt.config.ts b/nuxt.config.ts index b17f8df..d2f3afa 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -52,13 +52,13 @@ export default defineNuxtConfig({ discordTesterRoleId: '', discordSupporterRoleId: '', discourseSsoSecret: '', - apiBase: 'http://localhost:8056', + apiBase: 'https://api.pretendo.cc', apiBaseHost: 'api.pretendo.cc', public: { baseUrl: 'https://pretendo.network', hcaptchaSiteKey: '', - cookieSecure: false + cookieSecure: true } },