Skip to content

Commit

Permalink
fix server env variables, add readme description
Browse files Browse the repository at this point in the history
  • Loading branch information
jancimertel committed Jun 14, 2024
1 parent 2d75a91 commit d01ba71
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 20 deletions.
17 changes: 8 additions & 9 deletions packages/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,14 @@ The `build` process transpiles typescript files to javascript.

Make sure to have appropriate `.env.<ENV_FILE>` file accessible (e.g., running `ENV_FILE=production pnpm start:dist` will need `env.production`). You can use the `example.env` file as a template for creating your own `env` file, just check and modify the values here if needed:

- `NODE_ENV` =
- `DOMAIN` =
- `STATIC_PATH` =
- `SWAGGER_FILE` =
- `PORT` =
- `SECRET` =
- `NODEMAILER_API_KEY` =
- `MAILER_SENDER` =
- `PYTHON_API_HOST` =
- `NODE_ENV` = environment - production/development (security vs logging)
- `DOMAIN` = identify the instance - points to the domain where the ui should be accessible (used in emails)
- `STATIC_PATH` = http relative path to client files served by the server, use '/' for files hosted in root path
- `PORT` = port which should be used for this app
- `SECRET` = for signing jwt token
- `SENDGRID_API_KEY` = for sendgrid (mails) api integration
- `MAILER_SENDER` = default address of the mail sender
- `PYTHON_API_HOST` = custom analytics api, optional

## API docs

Expand Down
18 changes: 9 additions & 9 deletions packages/server/env/example.env
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# Environment - used for identyfing the environment
# environment - production/development (security vs logging)
NODE_ENV=development

# identify the instance - ie. for emails
# identify the instance - points to the domain where the ui should be accessible (used in emails)
DOMAIN=localhost:8000

# path to client files served by the server
# http relative path to client files served by the server, use '/' for files hosted in root path
STATIC_PATH=/

# serving swagger file from file
SWAGGER_FILE=

# port which should be used for this app
PORT=3000

# Flag for enabling SSL - loads cert.pem & key.pem from 'secret' dir
Expand All @@ -22,11 +20,13 @@ DB_NAME=inkvisitor
DB_AUTH=''
DB_POOL_CONNECTIONS=3

# For signing jwt token
# for signing jwt token
SECRET=supersecretpassword

# Mails - for sendgrid integration
NODEMAILER_API_KEY=
# for sendgrid (mails) api integration
SENDGRID_API_KEY=
# default address of the mail sender
MAILER_SENDER=

# custom analytics api, optional
PYTHON_API_HOST=http://localhost:5000
4 changes: 2 additions & 2 deletions packages/server/src/service/mailer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ class Mailer {
devMode = true;

constructor() {
if (process.env.NODEMAILER_API_KEY && process.env.MAILER_SENDER) {
if (process.env.SENDGRID_API_KEY && process.env.MAILER_SENDER) {
this.devMode = false;
}

sendgrid.setApiKey(process.env.NODEMAILER_API_KEY || "");
sendgrid.setApiKey(process.env.SENDGRID_API_KEY || "");

console.log(`[Mailer]: prepared${this.devMode ? " (dev mode)" : ""}`);
}
Expand Down

0 comments on commit d01ba71

Please sign in to comment.