This commit is contained in:
Simon Larsen 2023-09-07 17:25:33 +05:30
parent 1e0534a395
commit 37934c0677
No known key found for this signature in database
GPG Key ID: AB45983AA9C81CDE
2 changed files with 6 additions and 10 deletions

View File

@ -18,7 +18,7 @@ const DataMigrations: Array<DataMigrationBase> = [
new UpdateActiveMonitorCountToBillingProvider(),
new AddMonitoringDatesToMonitor(),
new AddDefaultGlobalConfig(),
new UpdateGlobalConfigFromEnv()
new UpdateGlobalConfigFromEnv(),
];
export default DataMigrations;

View File

@ -12,20 +12,18 @@ export default class UpdateGlobalConfigFromEnv extends DataMigrationBase {
// get all the users with email isVerified true.
await GlobalConfigService.updateOneById({
id: ObjectID.getZeroObjectID(),
id: ObjectID.getZeroObjectID(),
data: {
// Update Twilio
twilioAccountSID: process.env['TWILIO_ACCOUNT_SID'] || '',
twilioAuthToken: process.env['TWILIO_AUTH_TOKEN'] || '',
twilioPhoneNumber: process.env['TWILIO_PHONE_NUMBER'] || '',
// Update host
host: process.env['DOMAIN'] || 'localhost',
useHttps: process.env['HTTP_PROTOCOL'] === 'https',
// Update SMTP
smtpUsername: process.env['SMTP_USERNAME'] || '',
smtpPassword: process.env['SMTP_PASSWORD'] || '',
@ -34,13 +32,11 @@ export default class UpdateGlobalConfigFromEnv extends DataMigrationBase {
isSMTPSecure: process.env['SMTP_IS_SECURE'] === 'true',
smtpFromEmail: process.env['SMTP_FROM_EMAIL'] || '',
smtpFromName: process.env['SMTP_FROM_NAME'] || '',
},
props:
{
props: {
isRoot: true,
}
})
},
});
}
public override async rollback(): Promise<void> {