refactor(core): Load and validate all config at startup (no-changelog) (#5283)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-01-30 14:42:30 +01:00
committed by GitHub
parent b2f59c3f39
commit 72249e0de8
16 changed files with 80 additions and 163 deletions

View File

@@ -2,7 +2,6 @@ import { existsSync } from 'fs';
import { readFile } from 'fs/promises';
import Handlebars from 'handlebars';
import { join as pathJoin } from 'path';
import * as GenericHelpers from '@/GenericHelpers';
import config from '@/config';
import type {
InviteEmailData,
@@ -23,9 +22,7 @@ async function getTemplate(
): Promise<Template> {
let template = templates[templateName];
if (!template) {
const templateOverride = (await GenericHelpers.getConfigValue(
`userManagement.emails.templates.${templateName}`,
)) as string;
const templateOverride = config.getEnv(`userManagement.emails.templates.${templateName}`);
let markup;
if (templateOverride && existsSync(templateOverride)) {