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

@@ -2,6 +2,7 @@ import invariant from "invariant";
import { uniqBy } from "lodash";
import { Role } from "@shared/types";
import InviteEmail from "@server/emails/templates/InviteEmail";
import env from "@server/env";
import Logger from "@server/logging/logger";
import { User, Event, Team } from "@server/models";
import { UserFlag } from "@server/models/User";
@@ -89,11 +90,11 @@ export default async function userInviter({
teamUrl: team.url,
});
if (process.env.NODE_ENV === "development") {
if (env.ENVIRONMENT === "development") {
Logger.info(
"email",
`Sign in immediately: ${
process.env.URL
env.URL
}/auth/email.callback?token=${newUser.getEmailSigninToken()}`
);
}