refactor: use process.env in node environments (#51110)

This commit is contained in:
Oliver Eyton-Williams
2023-07-31 17:25:24 +02:00
committed by GitHub
parent c2fff83d41
commit 5f475cefa6
11 changed files with 67 additions and 46 deletions

View File

@@ -16,7 +16,6 @@ import uuid from 'uuid/v4';
import { isEmail } from 'validator';
import { blocklistedUsernames } from '../../../../config/constants';
import { apiLocation } from '../../../../config/env.json';
import { wrapHandledError } from '../../server/utils/create-handled-error.js';
import {
@@ -202,7 +201,7 @@ export default function initializeUser(User) {
exists => {
if (exists) {
throw wrapHandledError(new Error('user already exists'), {
redirectTo: `${apiLocation}/signin`,
redirectTo: `${process.env.API_LOCATION}/signin`,
message: dedent`
The ${user.email} email address is already associated with an account.
Try signing in with it here instead.
@@ -502,7 +501,7 @@ export default function initializeUser(User) {
}
const { id: loginToken, created: emailAuthLinkTTL } = token;
const loginEmail = getEncodedEmail(newEmail ? newEmail : null);
const host = apiLocation;
const host = process.env.API_LOCATION;
const mailOptions = {
type: 'email',
to: newEmail ? newEmail : this.email,