2022-05-30 21:08:07 +03:00
|
|
|
export function enableMailgun(server, enabled = true) {
|
2022-04-21 16:48:25 +03:00
|
|
|
server.db.settings.find({key: 'mailgun_api_key'})
|
2022-05-30 21:08:07 +03:00
|
|
|
? server.db.settings.update({key: 'mailgun_api_key'}, {value: (enabled ? 'MAILGUN_API_KEY' : null)})
|
|
|
|
: server.create('setting', {key: 'mailgun_api_key', value: (enabled ? 'MAILGUN_API_KEY' : null), group: 'email'});
|
2022-04-21 16:48:25 +03:00
|
|
|
|
|
|
|
server.db.settings.find({key: 'mailgun_domain'})
|
2022-05-30 21:08:07 +03:00
|
|
|
? server.db.settings.update({key: 'mailgun_domain'}, {value: (enabled ? 'MAILGUN_DOMAIN' : null)})
|
|
|
|
: server.create('setting', {key: 'mailgun_domain', value: (enabled ? 'MAILGUN_DOMAIN' : null), group: 'email'});
|
2022-04-21 16:48:25 +03:00
|
|
|
|
|
|
|
server.db.settings.find({key: 'mailgun_base_url'})
|
2022-05-30 21:08:07 +03:00
|
|
|
? server.db.settings.update({key: 'mailgun_base_url'}, {value: (enabled ? 'MAILGUN_BASE_URL' : null)})
|
|
|
|
: server.create('setting', {key: 'mailgun_base_url', value: (enabled ? 'MAILGUN_BASE_URL' : null), group: 'email'});
|
|
|
|
}
|
|
|
|
|
|
|
|
export function disableMailgun(server) {
|
|
|
|
enableMailgun(server, false);
|
2022-04-21 16:48:25 +03:00
|
|
|
}
|