add support for env config.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
const fs = require("fs")
|
||||
|
||||
const config = {
|
||||
let config = {
|
||||
graphqlEndpoint: "http://127.0.0.1:17000/graphql",
|
||||
playgroundEndpoint: "http://127.0.0.1:17000/playground",
|
||||
port: 8080,
|
||||
@@ -35,6 +35,31 @@ if (typeof(window) !== "undefined") {
|
||||
delete config.redis
|
||||
delete config.backend
|
||||
} else {
|
||||
config = {
|
||||
graphqlEndpoint: process.env.RPDATA_API_GRAPHQL || "http://127.0.0.1:17000/graphql",
|
||||
playgroundEndpoint: process.env.RPDATA_API_PLAYGROUND || "http://127.0.0.1:17000/playground",
|
||||
port: Number(process.env.PORT || "8080"),
|
||||
root: process.env.ROOT || "http://localhost:8080",
|
||||
trustedProxy: process.env.TRUSTED_PROXY || null,
|
||||
auth0: {
|
||||
secret: process.env.AUTH0_SECRET || "INVALID_SECRET",
|
||||
clientId: process.env.AUTH0_CLIENT_ID || "",
|
||||
domain: process.env.AUTH0_DOMAIN || "aiterp.eu.auth0.com",
|
||||
},
|
||||
session: {
|
||||
secret: process.env.SESSION_SECRET || "",
|
||||
secure: process.env.SESSION_SECURE === "true",
|
||||
},
|
||||
redis: {
|
||||
host: process.env.REDIS_HOST || "127.0.0.1",
|
||||
port: process.env.REDIS_PORT || 6379,
|
||||
},
|
||||
backend: {
|
||||
kid: process.env.RPDATA_KID || "",
|
||||
secret: process.env.RPDATA_SECRET || "",
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
const data = fs.readFileSync("/etc/aiterp/rpdata-frontend.json", "utf8")
|
||||
const parsed = JSON.parse(data)
|
||||
|
||||
Reference in New Issue
Block a user