-
Notifications
You must be signed in to change notification settings - Fork 7
/
generate-env.js
36 lines (31 loc) · 1.16 KB
/
generate-env.js
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
27
28
29
30
31
32
33
34
35
36
const dotenv = require('dotenv')
const path = require('path')
const fs = require('fs')
dotenv.config({
override: true,
})
const content = `
if (window && typeof process === 'undefined') {
window.process = {
env: {
API_RETRY_DELAY_MIN: ${process.env.API_RETRY_DELAY_MIN},
API_RETRY_DELAY_MAX: ${process.env.API_RETRY_DELAY_MAX},
API_RETRY_COUNT: ${process.env.API_RETRY_COUNT},
ASYNC_SEARCH_POLL_SIZE: ${process.env.ASYNC_SEARCH_POLL_SIZE},
ASYNC_SEARCH_POLL_INTERVAL: ${process.env.ASYNC_SEARCH_POLL_INTERVAL},
ASYNC_SEARCH_ERROR_MULTIPLIER: ${process.env.ASYNC_SEARCH_ERROR_MULTIPLIER},
ASYNC_SEARCH_ERROR_SUMMATION: ${process.env.ASYNC_SEARCH_ERROR_SUMMATION},
HOOVER_MAPS_ENABLED: ${process.env.HOOVER_MAPS_ENABLED},
HOOVER_UPLOADS_ENABLED: ${process.env.HOOVER_UPLOADS_ENABLED},
HOOVER_TRANSLATION_ENABLED: ${process.env.HOOVER_TRANSLATION_ENABLED},
}
}
}
`
fs.writeFile('./out/env.js', content, (err) => {
if (err) {
console.error(err)
} else {
// file written successfully
}
})