chore: Centralize env parsing, validation, defaults, and deprecation notices (#3487)

* chore: Centralize env parsing, defaults, deprecation

* wip

* test

* test

* tsc

* docs, more validation

* fix: Allow empty REDIS_URL (defaults to localhost)

* test

* fix: SLACK_MESSAGE_ACTIONS not bool

* fix: Add SMTP port validation
This commit is contained in:
Tom Moor
2022-05-19 08:05:11 -07:00
committed by GitHub
parent 51001cfac1
commit 3c002f82cc
66 changed files with 783 additions and 341 deletions

View File

@@ -1,10 +1,11 @@
import { init, tracer, addTags, markAsError } from "@theo.gravity/datadog-apm";
import env from "@server/env";
export * as APM from "@theo.gravity/datadog-apm";
// If the DataDog agent is installed and the DD_API_KEY environment variable is
// in the environment then we can safely attempt to start the DD tracer
if (process.env.DD_API_KEY) {
if (env.DD_API_KEY) {
init(
{
// SOURCE_COMMIT is used by Docker Hub
@@ -13,7 +14,7 @@ if (process.env.DD_API_KEY) {
service: process.env.DD_SERVICE || "outline",
},
{
useMock: process.env.NODE_ENV === "test",
useMock: env.ENVIRONMENT === "test",
}
);
}