Compare commits

..
3 Commits
Author SHA1 Message Date
gisle 268f906ea4 show config. 2024-08-17 22:24:14 +02:00
gisle 44a98c8823 add support for env config. 2024-08-17 13:43:03 +02:00
gisle fe44300c0a fix date wonk
continuous-integration/drone/push Build is passing
2022-11-16 18:36:05 +01:00
2 changed files with 32 additions and 2 deletions
+31 -1
View File
@@ -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)
@@ -44,6 +69,11 @@ if (typeof(window) !== "undefined") {
} catch(err) {
console.error("Failed to load configuration: " + err.message || err.stack || err)
}
console.log("Config/Auth0", config.auth0.clientId, config.auth0.domain);
console.log("Config/API", config.graphqlEndpoint, config.backend.kid);
console.log("Config/Redis", config.redis.host, config.redis.port);
console.log("Config/Root", config.root);
}
module.exports = config
@@ -31,7 +31,7 @@ module.exports = class {
let fictionalDate = new Date(comment.fictionalDate)
if (comment.fictionalDate && !Number.isNaN(fictionalDate.getTime()) && fictionalDate.getTime() !== 0) {
fictionalDate = moment(fictionalDate).format("MMM D, YYYY")
fictionalDate = moment.utc(fictionalDate).format("MMM D, YYYY")
} else {
fictionalDate = ""
}