const fs = require("fs") const config = { graphqlEndpoint: "http://127.0.0.1:17000/graphql", playgroundEndpoint: "http://127.0.0.1:17000/playground", port: 8080, root: "http://localhost:8080", trustedProxy: null, auth0: { secret: "INVALID_SECRET", clientId: "", domain: "aiterp.eu.auth0.com", }, session: { secret: "", secure: false, }, redis: { host: "127.0.0.1", port: 6379, }, backend: { kid: "", secret: "", } } if (typeof(window) !== "undefined") { config.graphqlEndpoint = "/graphql" delete config.port delete config.root delete config.auth0 delete config.session delete config.redis delete config.backend } else { try { const data = fs.readFileSync("/etc/aiterp/rpdata-frontend.json", "utf8") const parsed = JSON.parse(data) if (typeof(parsed) == "object" && !Array.isArray(parsed)) { Object.assign(config, parsed) } } catch(err) { console.error("Failed to load configuration: " + err.message || err.stack || err) } } module.exports = config