mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
added env var for accounts
This commit is contained in:
@@ -4,7 +4,18 @@ const app = express();
|
||||
|
||||
app.use(express.static(path.join(__dirname, 'build')));
|
||||
|
||||
app.get('/*', function(req, res) {
|
||||
var env = {
|
||||
TEST: 'TEST',
|
||||
FYIPE_HOSTED: process.env.FYIPE_HOSTED,
|
||||
HOST: process.env.HOST,
|
||||
ACCOUNTS_HOST: process.env.ACCOUNTS_HOST,
|
||||
BACKEND_HOST: process.env.BACKEND_HOST
|
||||
}
|
||||
|
||||
app.get('/env', function (req, res) {
|
||||
res.send(JSON.stringify(env));
|
||||
})
|
||||
app.get('/*', function (req, res) {
|
||||
res.sendFile(path.join(__dirname, 'build', 'index.html'));
|
||||
});
|
||||
|
||||
|
||||
@@ -29,20 +29,29 @@ let adminDashboardUrl = null;
|
||||
|
||||
|
||||
// }
|
||||
|
||||
if (!isServer) {
|
||||
if (window.location.href.indexOf('localhost') > -1) {
|
||||
apiUrl = 'http://localhost:3002';
|
||||
dashboardUrl = 'http://localhost:3000';
|
||||
domain = 'localhost';
|
||||
adminDashboardUrl = 'http://localhost:3100';
|
||||
} else {
|
||||
apiUrl = 'http://backend:3002';
|
||||
dashboardUrl = 'http://dashboard:3000';
|
||||
domain = 'local';
|
||||
}
|
||||
function getEnvVars(){
|
||||
axios.get('http://localhost:3003/env')
|
||||
.then(resp => resp.data)
|
||||
.then(env => {
|
||||
if (!isServer) {
|
||||
if (window.location.href.indexOf('localhost') > -1) {
|
||||
apiUrl = 'http://localhost:3002';
|
||||
dashboardUrl = 'http://localhost:3000';
|
||||
domain = 'localhost';
|
||||
adminDashboardUrl = 'http://localhost:3100';
|
||||
} else {
|
||||
domain = 'local';
|
||||
apiUrl = env.BACKEND_HOST;
|
||||
dashboardUrl = env.DASHBOARD_HOST;
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err)
|
||||
})
|
||||
}
|
||||
|
||||
getEnvVars();
|
||||
|
||||
export const API_URL = apiUrl;
|
||||
|
||||
|
||||
@@ -82,11 +82,11 @@ spec:
|
||||
- name: FYIPE_HOSTED
|
||||
value: "true"
|
||||
- name: HOST
|
||||
value: "accounts"
|
||||
value: "accounts:3003"
|
||||
- name: BACKEND_HOST
|
||||
value: "backend"
|
||||
value: "backend:3002"
|
||||
- name: DASHBOARD_HOST
|
||||
value: "dashboard"
|
||||
value: "dashboard:3000"
|
||||
ports:
|
||||
- containerPort: 3003
|
||||
hostPort: 3003
|
||||
|
||||
Reference in New Issue
Block a user