mirror of
https://github.com/stonith404/pingvin-share.git
synced 2025-01-15 01:14:27 -05:00
feat: add support for different email and user
This commit is contained in:
parent
bfb0d151ea
commit
888a0c5faf
2 changed files with 28 additions and 4 deletions
|
@ -74,7 +74,13 @@ const configVariables: Prisma.ConfigCreateInput[] = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "SMTP_EMAIL",
|
key: "SMTP_EMAIL",
|
||||||
description: "Email address of the SMTP server",
|
description: "Email address which the emails get sent from",
|
||||||
|
type: "string",
|
||||||
|
value: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "SMTP_USERNAME",
|
||||||
|
description: "Username of the SMTP server",
|
||||||
type: "string",
|
type: "string",
|
||||||
value: "",
|
value: "",
|
||||||
},
|
},
|
||||||
|
@ -103,14 +109,32 @@ async function main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete the config variable if it doesn't exist anymore
|
|
||||||
const configVariablesFromDatabase = await prisma.config.findMany();
|
const configVariablesFromDatabase = await prisma.config.findMany();
|
||||||
|
|
||||||
|
// Delete the config variable if it doesn't exist anymore
|
||||||
for (const configVariableFromDatabase of configVariablesFromDatabase) {
|
for (const configVariableFromDatabase of configVariablesFromDatabase) {
|
||||||
if (!configVariables.find((v) => v.key == configVariableFromDatabase.key)) {
|
const configVariable = configVariables.find(
|
||||||
|
(v) => v.key == configVariableFromDatabase.key
|
||||||
|
);
|
||||||
|
if (!configVariable) {
|
||||||
await prisma.config.delete({
|
await prisma.config.delete({
|
||||||
where: { key: configVariableFromDatabase.key },
|
where: { key: configVariableFromDatabase.key },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Update the config variable if the metadata changed
|
||||||
|
} else if (
|
||||||
|
JSON.stringify({
|
||||||
|
key: configVariableFromDatabase.key,
|
||||||
|
value: configVariableFromDatabase.value,
|
||||||
|
...configVariable,
|
||||||
|
}) != JSON.stringify(configVariableFromDatabase)
|
||||||
|
) {
|
||||||
|
await prisma.config.update({
|
||||||
|
where: { key: configVariableFromDatabase.key },
|
||||||
|
data: configVariables.find(
|
||||||
|
(v) => v.key == configVariableFromDatabase.key
|
||||||
|
),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ export class EmailService {
|
||||||
port: parseInt(this.config.get("SMTP_PORT")),
|
port: parseInt(this.config.get("SMTP_PORT")),
|
||||||
secure: parseInt(this.config.get("SMTP_PORT")) == 465,
|
secure: parseInt(this.config.get("SMTP_PORT")) == 465,
|
||||||
auth: {
|
auth: {
|
||||||
user: this.config.get("SMTP_EMAIL"),
|
user: this.config.get("SMTP_USERNAME"),
|
||||||
pass: this.config.get("SMTP_PASSWORD"),
|
pass: this.config.get("SMTP_PASSWORD"),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue