2021-03-30 03:00:40 +13:00
|
|
|
function isDev() {
|
|
|
|
return process.env.NODE_ENV !== "production"
|
|
|
|
}
|
|
|
|
|
2021-04-16 03:25:48 +12:00
|
|
|
function isTest() {
|
|
|
|
return (
|
|
|
|
process.env.NODE_ENV === "jest" ||
|
|
|
|
process.env.NODE_ENV === "cypress" ||
|
|
|
|
process.env.JEST_WORKER_ID != null
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2021-03-30 03:00:40 +13:00
|
|
|
let LOADED = false
|
2021-05-06 04:49:34 +12:00
|
|
|
if (!LOADED && isDev() && !isTest()) {
|
2021-03-30 03:00:40 +13:00
|
|
|
require("dotenv").config()
|
|
|
|
LOADED = true
|
|
|
|
}
|
|
|
|
|
2020-12-17 08:50:02 +13:00
|
|
|
module.exports = {
|
2021-08-05 20:59:08 +12:00
|
|
|
NODE_ENV: process.env.NODE_ENV,
|
2020-12-17 08:50:02 +13:00
|
|
|
SELF_HOSTED: process.env.SELF_HOSTED,
|
|
|
|
PORT: process.env.PORT,
|
2021-05-22 01:38:46 +12:00
|
|
|
CLUSTER_PORT: process.env.CLUSTER_PORT,
|
2020-12-17 08:50:02 +13:00
|
|
|
MINIO_ACCESS_KEY: process.env.MINIO_ACCESS_KEY,
|
|
|
|
MINIO_SECRET_KEY: process.env.MINIO_SECRET_KEY,
|
2021-03-30 03:00:40 +13:00
|
|
|
MINIO_URL: process.env.MINIO_URL,
|
|
|
|
COUCH_DB_URL: process.env.COUCH_DB_URL,
|
|
|
|
LOG_LEVEL: process.env.LOG_LEVEL,
|
2021-03-30 05:31:41 +13:00
|
|
|
JWT_SECRET: process.env.JWT_SECRET,
|
|
|
|
SALT_ROUNDS: process.env.SALT_ROUNDS,
|
2021-04-28 04:29:05 +12:00
|
|
|
REDIS_URL: process.env.REDIS_URL,
|
|
|
|
REDIS_PASSWORD: process.env.REDIS_PASSWORD,
|
2021-05-12 02:23:03 +12:00
|
|
|
INTERNAL_API_KEY: process.env.INTERNAL_API_KEY,
|
2021-08-05 20:59:08 +12:00
|
|
|
MULTI_TENANCY: process.env.MULTI_TENANCY,
|
2021-08-12 22:51:08 +12:00
|
|
|
SANDBOX: process.env.SANDBOX,
|
2020-12-17 08:50:02 +13:00
|
|
|
_set(key, value) {
|
|
|
|
process.env[key] = value
|
|
|
|
module.exports[key] = value
|
|
|
|
},
|
2021-03-30 03:00:40 +13:00
|
|
|
isDev,
|
2021-04-16 03:25:48 +12:00
|
|
|
isTest,
|
|
|
|
isProd: () => {
|
|
|
|
return !isDev()
|
|
|
|
},
|
2020-12-17 08:50:02 +13:00
|
|
|
}
|