From c0984002a582244020fa5b84197c5a982cd7c7f9 Mon Sep 17 00:00:00 2001 From: dumbutdumber Date: Thu, 25 Sep 2025 12:58:58 +0530 Subject: [PATCH] Update configuration.mdx --- pages/backend/configuration.mdx | 36 +++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/pages/backend/configuration.mdx b/pages/backend/configuration.mdx index 36ee659..7ca6ca7 100644 --- a/pages/backend/configuration.mdx +++ b/pages/backend/configuration.mdx @@ -4,20 +4,44 @@ title: 'Configuration' # Backend Config Reference -The backend can be configured using: +The backend can be configured in 3 different ways: +- Make a `config.json` file in the working directory of the application (root of repository) +- Make a `.env` file in the working directory of the application (root of repository) - Add environment variables to your system (or container) +These different config options are all mutually inclusive, so you can use multiple at the same time if you want to. + With any of these configurations, you have to have atleast three variables set - for the server to function: [`DATABASE_URL`](#postgres-connection-⚠), - [`CRYPTO_SECRET`](#crypto-session-secret-⚠) and - [`META_NAME`](#meta-name-⚠) + for the server to function: [`postgres.connection`](#postgres-connection-⚠), + [`crypto.sessionSecret`](#crypto-session-secret-⚠) and + [`meta.name`](#meta-name-⚠) -### Method - Environment +### Method 1 - `config.json` -You add the variables to the environment. +This method uses nesting, so the key `server.basePath` with the value of `"/backend"` will result in a file that looks like this: + +```json +{ + "server": { + "basePath": "/backend" + } +} +``` + +### Method 2 - `.env` + +The environment variable names use double underscores as separators and `MWB_` as the prefix. So the key `server.basePath` will result in the .env file like this: + +```sh +MWB_SERVER__BASE_PATH=/backend +``` + +### Method 3 - Environment + +This method is identical to the `.env` method listed above, but you add the variables to the environment instead of writing it in a file. # Reference