-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenvConfig.js
More file actions
26 lines (24 loc) · 1011 Bytes
/
Copy pathenvConfig.js
File metadata and controls
26 lines (24 loc) · 1011 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function configMissing(configSetting) {
throw new Error(`missing required .env setting: ${configSetting}`);
}
const envConfig = () => ({
endpoint: process.env.ENDPOINT_CHK || configMissing('ENDPOINT_CHK'),
testLocation: process.env.TEST_LOCATION || 'Test Location',
updateOnChange: JSON.parse(process.env.UPDATE_ON_CHANGE ?? false),
postmark: {
token: process.env.POSTMARK_TOKEN || configMissing('POSTMARK_TOKEN'),
emailto: process.env.EMAIL_TO || configMissing('EMAIL_TO'),
emailfrom: process.env.EMAIL_FROM || configMissing('EMAIL_FROM'),
},
CloudFlare: {
// new-style cf api key
apiToken: process.env.CF_BEARER_TOKEN ?? null,
// base api uri
apiBase: 'https://api.cloudflare.com/client/v4/',
// domain which has the dns record we're updating
zoneDomain: process.env.CF_ZONE_DOMAIN ?? null,
// the actualy dns record being updated (assuming type A);
recordHostname: process.env.CF_DNS_RECORD_HOSTNAME ?? null,
},
});
module.exports = envConfig();