reverse-proxy-frontend/config.js

34 lines
964 B
JavaScript
Raw Normal View History

2022-09-26 19:03:03 +03:00
const appInfo = require("./package.json");
const appVersion = appInfo.version ?? "0.0.0";
const appDate = new Date();
2021-09-07 09:42:48 +03:00
const dev = {
2022-07-16 14:02:14 +03:00
NODE_ENV: "development",
2022-09-26 19:03:03 +03:00
APP_VERSION: appVersion,
APP_DATE: appDate,
REVERSE_PROXY_API_URL: "http://localhost:5050",
2021-09-07 09:42:48 +03:00
CHATBOT_API_URL: "http://localhost:5061",
2022-12-28 18:01:14 +02:00
REVERSE_PROXY_DOCS_URL: "https://lab.code-rove.com/hedgedoc/s/UkJ6S5NJz"
2021-09-07 09:42:48 +03:00
};
2021-09-07 19:21:25 +03:00
const prod = {
NODE_ENV: "production",
2022-09-26 19:03:03 +03:00
APP_VERSION: appVersion,
APP_DATE: appDate,
2021-09-07 19:21:25 +03:00
PUBLIC_URL: "/reverse-proxy",
2022-12-28 18:01:14 +02:00
REVERSE_PROXY_API_URL: "https://lab.code-rove.com/reverse-proxy-api",
CHATBOT_API_URL: "https://lab.code-rove.com/chatbot-api",
REVERSE_PROXY_DOCS_URL: "https://lab.code-rove.com/hedgedoc/s/UkJ6S5NJz"
2021-09-07 19:21:25 +03:00
};
2022-12-28 18:01:14 +02:00
const getConfig = (env) => {
2022-07-16 14:02:14 +03:00
const config = env === "prod" ? prod : dev;
let configs = {};
2022-12-28 18:01:14 +02:00
Object.keys(config).forEach((z) => {
2022-07-16 14:02:14 +03:00
configs[`process.env.${z}`] = JSON.stringify(config[z]);
});
return configs;
};
module.exports = getConfig;