Downstream: mail provider debug values
Updates configuration to allow for indication of when a production run is being performed in an environment, and refactors the layering of those config values. Also minor updates to package dependencies.
This commit is contained in:
Родитель
f5f8e395e5
Коммит
02b4d8846c
18
.cspell.json
18
.cspell.json
|
@ -23,6 +23,7 @@
|
|||
"enableGlobDot": true,
|
||||
"useGitignore": true,
|
||||
"words": [
|
||||
"aadgraph",
|
||||
"aadid",
|
||||
"aadname",
|
||||
"aadoid",
|
||||
|
@ -114,6 +115,7 @@
|
|||
"cloudmine",
|
||||
"CloudMine",
|
||||
"clsdir",
|
||||
"clust",
|
||||
"cnames",
|
||||
"CNTK",
|
||||
"codeofconductcoursecompleted",
|
||||
|
@ -165,7 +167,9 @@
|
|||
"datamonth",
|
||||
"datamonthiso",
|
||||
"datasharing",
|
||||
"datatable",
|
||||
"DATETIME",
|
||||
"dcount",
|
||||
"dbaeumer",
|
||||
"decisionmaker",
|
||||
"Decisionmaker",
|
||||
|
@ -271,6 +275,7 @@
|
|||
"ghid",
|
||||
"GHID",
|
||||
"ghname",
|
||||
"ghowners",
|
||||
"GHPI",
|
||||
"ghpimigrationphase",
|
||||
"ghrp",
|
||||
|
@ -294,6 +299,7 @@
|
|||
"godo",
|
||||
"goodfirstissue",
|
||||
"grantedtime",
|
||||
"graphviz",
|
||||
"hackathon",
|
||||
"hackathons",
|
||||
"hardlimit",
|
||||
|
@ -360,6 +366,7 @@
|
|||
"labelloc",
|
||||
"languagesspoken",
|
||||
"latrop",
|
||||
"leftouter",
|
||||
"legalcontact",
|
||||
"legalentities",
|
||||
"lightup",
|
||||
|
@ -382,6 +389,7 @@
|
|||
"lowercaser",
|
||||
"luxon",
|
||||
"maillist",
|
||||
"mailout",
|
||||
"mailwithsemicolon",
|
||||
"maint",
|
||||
"maintainercorporateids",
|
||||
|
@ -397,6 +405,7 @@
|
|||
"managerid",
|
||||
"managerunlink",
|
||||
"Markdownlint",
|
||||
"MCAPS",
|
||||
"MEMBERTOMAINTAINER",
|
||||
"memex",
|
||||
"mergedpullscount",
|
||||
|
@ -476,6 +485,7 @@
|
|||
"opensource",
|
||||
"OPENSOURCE",
|
||||
"opensourcecontributions",
|
||||
"opensourcedirectowners",
|
||||
"opensourcedocs",
|
||||
"opensourcedocsprod",
|
||||
"opensourceprod",
|
||||
|
@ -646,6 +656,7 @@
|
|||
"Satya",
|
||||
"scansummary",
|
||||
"scorecardreprocessrequest",
|
||||
"SCIM",
|
||||
"secretscanningonpush",
|
||||
"secscandata",
|
||||
"securitygroupalias",
|
||||
|
@ -694,6 +705,7 @@
|
|||
"SSIRP",
|
||||
"sslify",
|
||||
"Sslify",
|
||||
"standardsredirect",
|
||||
"stargazerscount",
|
||||
"startclean",
|
||||
"StartClean",
|
||||
|
@ -728,6 +740,7 @@
|
|||
"thirdpartytype",
|
||||
"thirdpartyusername",
|
||||
"thirtypercent",
|
||||
"threatmodel",
|
||||
"tickettype",
|
||||
"timeago",
|
||||
"timebound",
|
||||
|
@ -735,12 +748,16 @@
|
|||
"timezonename",
|
||||
"timezoneoffset",
|
||||
"tlink",
|
||||
"tolower",
|
||||
"totalcount",
|
||||
"toupper",
|
||||
"touchedtime",
|
||||
"treatedconsent",
|
||||
"treateddirectmanager",
|
||||
"Treateds",
|
||||
"tsbuild",
|
||||
"Tpng",
|
||||
"Tsvg",
|
||||
"twentypercent",
|
||||
"typeahead",
|
||||
"typeaheadjs",
|
||||
|
@ -807,6 +824,7 @@
|
|||
"workboarding",
|
||||
"xamarinhq",
|
||||
"Xcache",
|
||||
"xlink",
|
||||
"XSTORE",
|
||||
"xtable",
|
||||
"yamls"
|
||||
|
|
|
@ -6,3 +6,5 @@ dist
|
|||
|
||||
# View
|
||||
views/email/email.css
|
||||
|
||||
.environment/copilot/
|
||||
|
|
|
@ -899,7 +899,9 @@ export class Operations
|
|||
return repository;
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
if (!ErrorHelper.IsNotFound(err)) {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
{
|
||||
"provider": "env://MAIL_PROVIDER",
|
||||
"from": "env://MAIL_FROM",
|
||||
"overrideRecipient": "env://MAIL_OVERRIDE_RECIPIENT",
|
||||
"debug": {
|
||||
"overrideRecipient": "env://MAIL_OVERRIDE_RECIPIENT",
|
||||
"isProductionRun": "env://EMAIL_PRODUCTION_RUN?trueIf=1",
|
||||
"testTargetCorporateId": "env://TARGET_CORPORATE_ID"
|
||||
},
|
||||
"customService": {
|
||||
"url": "env://MAIL_CUSTOMSERVICE_URL",
|
||||
"apiKey": "env://MAIL_CUSTOMSERVICE_KEY",
|
||||
|
|
|
@ -10,7 +10,12 @@ export type ConfigRootMail = {
|
|||
export type ConfigMail = {
|
||||
provider: string;
|
||||
from: string;
|
||||
overrideRecipient: string;
|
||||
|
||||
debug: {
|
||||
overrideRecipient: string;
|
||||
isProductionRun: boolean;
|
||||
testTargetCorporateId: string;
|
||||
};
|
||||
|
||||
customService: {
|
||||
url: string;
|
||||
|
|
|
@ -30,7 +30,7 @@ export interface IMailProvider {
|
|||
}
|
||||
|
||||
export function isOverridingRecipients(config: SiteConfiguration) {
|
||||
return !!config.mail.overrideRecipient;
|
||||
return !!config.mail.debug.overrideRecipient;
|
||||
}
|
||||
|
||||
function patchOverride(provider, newToAddress, htmlOrNot) {
|
||||
|
@ -74,15 +74,15 @@ function patchOverride(provider, newToAddress, htmlOrNot) {
|
|||
return provider;
|
||||
}
|
||||
|
||||
export function createMailProviderInstance(config): IMailProvider {
|
||||
export function createMailProviderInstance(config: SiteConfiguration): IMailProvider {
|
||||
const deployment = getCompanySpecificDeployment();
|
||||
let mailProvider: IMailProvider = null;
|
||||
const mailConfig = config.mail;
|
||||
if (deployment?.features?.mailProvider?.tryCreateInstance) {
|
||||
mailProvider = deployment.features.mailProvider.tryCreateInstance(config);
|
||||
if (mailProvider) {
|
||||
if (mailConfig.overrideRecipient) {
|
||||
patchOverride(mailProvider, mailConfig.overrideRecipient, mailProvider.html);
|
||||
if (mailConfig.debug.overrideRecipient) {
|
||||
patchOverride(mailProvider, mailConfig.debug.overrideRecipient, mailProvider.html);
|
||||
}
|
||||
return mailProvider;
|
||||
}
|
||||
|
@ -109,8 +109,8 @@ export function createMailProviderInstance(config): IMailProvider {
|
|||
);
|
||||
}
|
||||
}
|
||||
if (mailConfig.overrideRecipient) {
|
||||
patchOverride(mailProvider, mailConfig.overrideRecipient, mailProvider.html);
|
||||
if (mailConfig.debug.overrideRecipient) {
|
||||
patchOverride(mailProvider, mailConfig.debug.overrideRecipient, mailProvider.html);
|
||||
}
|
||||
return mailProvider;
|
||||
}
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
26
package.json
26
package.json
|
@ -67,8 +67,8 @@
|
|||
"@azure/cosmos": "3.17.3",
|
||||
"@azure/data-tables": "13.2.1",
|
||||
"@azure/identity": "3.1.3",
|
||||
"@azure/keyvault-secrets": "4.6.0",
|
||||
"@azure/service-bus": "7.8.0",
|
||||
"@azure/keyvault-secrets": "4.7.0",
|
||||
"@azure/service-bus": "7.8.1",
|
||||
"@azure/storage-blob": "12.13.0",
|
||||
"@azure/storage-queue": "12.12.0",
|
||||
"@octokit/plugin-paginate-graphql": "2.0.1",
|
||||
|
@ -86,7 +86,7 @@
|
|||
"connect-redis": "7.0.1",
|
||||
"cors": "2.8.5",
|
||||
"debug": "4.3.4",
|
||||
"deepmerge": "4.3.0",
|
||||
"deepmerge": "4.3.1",
|
||||
"dotenv": "16.0.3",
|
||||
"express": "4.18.2",
|
||||
"express-async-handler": "1.1.4",
|
||||
|
@ -130,12 +130,12 @@
|
|||
"@types/debug": "4.1.7",
|
||||
"@types/express": "4.17.17",
|
||||
"@types/express-session": "1.17.6",
|
||||
"@types/jest": "29.4.0",
|
||||
"@types/jest": "29.5.0",
|
||||
"@types/lodash": "4.14.191",
|
||||
"@types/luxon": "3.2.0",
|
||||
"@types/memory-cache": "0.2.2",
|
||||
"@types/morgan": "1.9.4",
|
||||
"@types/node": "18.14.6",
|
||||
"@types/node": "18.15.3",
|
||||
"@types/node-jose": "1.1.10",
|
||||
"@types/object-path": "0.11.1",
|
||||
"@types/passport": "1.0.12",
|
||||
|
@ -145,24 +145,24 @@
|
|||
"@types/pug": "2.0.6",
|
||||
"@types/recursive-readdir": "2.2.1",
|
||||
"@types/semver": "7.3.13",
|
||||
"@types/simple-oauth2": "5.0.2",
|
||||
"@types/validator": "13.7.13",
|
||||
"@typescript-eslint/eslint-plugin": "5.54.1",
|
||||
"@typescript-eslint/parser": "5.54.1",
|
||||
"cspell": "6.28.0",
|
||||
"eslint": "8.35.0",
|
||||
"@types/simple-oauth2": "5.0.3",
|
||||
"@types/validator": "13.7.14",
|
||||
"@typescript-eslint/eslint-plugin": "5.55.0",
|
||||
"@typescript-eslint/parser": "5.55.0",
|
||||
"cspell": "6.30.0",
|
||||
"eslint": "8.36.0",
|
||||
"eslint-config-prettier": "8.7.0",
|
||||
"eslint-plugin-n": "15.6.1",
|
||||
"eslint-plugin-prettier": "4.2.1",
|
||||
"husky": "8.0.3",
|
||||
"jest": "29.5.0",
|
||||
"jest-junit": "15.0.0",
|
||||
"lint-staged": "13.1.2",
|
||||
"lint-staged": "13.2.0",
|
||||
"markdownlint-cli2": "0.6.0",
|
||||
"prettier": "2.8.4",
|
||||
"ts-jest": "29.0.5",
|
||||
"ts-node": "10.9.1",
|
||||
"typescript": "4.9.5"
|
||||
"typescript": "5.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16"
|
||||
|
|
Загрузка…
Ссылка в новой задаче