fix: DATABASE_URL missing in env does not produce validation error (#4409)

* fix: DATABASE_URL missing in env does not produce validation error

* lint
This commit is contained in:
Tom Moor
2022-11-11 07:11:10 -08:00
committed by GitHub
parent d0827e21c1
commit 26946853da
2 changed files with 29 additions and 28 deletions

View File

@@ -51,14 +51,14 @@ export class Environment {
* set or your users will be unable to login.
*/
@IsByteLength(32, 64)
public SECRET_KEY = `${process.env.SECRET_KEY}`;
public SECRET_KEY = process.env.SECRET_KEY ?? "";
/**
* The secret that should be passed to the cron utility endpoint to enable
* triggering of scheduled tasks.
*/
@IsNotEmpty()
public UTILS_SECRET = `${process.env.UTILS_SECRET}`;
public UTILS_SECRET = process.env.UTILS_SECRET ?? "";
/**
* The url of the database.
@@ -69,7 +69,7 @@ export class Environment {
allow_underscores: true,
protocols: ["postgres", "postgresql"],
})
public DATABASE_URL = `${process.env.DATABASE_URL}`;
public DATABASE_URL = process.env.DATABASE_URL ?? "";
/**
* The url of the database pool.
@@ -125,7 +125,7 @@ export class Environment {
*/
@IsNotEmpty()
@IsUrl({ require_tld: false })
public URL = `${process.env.URL}`;
public URL = process.env.URL || "";
/**
* If using a Cloudfront/Cloudflare distribution or similar it can be set below.
@@ -157,7 +157,7 @@ export class Environment {
/**
* Optional extra debugging. Comma separated
*/
public DEBUG = `${process.env.DEBUG}`;
public DEBUG = process.env.DEBUG || "";
/**
* How many processes should be spawned. As a reasonable rule divide your