mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
accounts: update config.js
This commit is contained in:
@@ -4,17 +4,6 @@ const app = express();
|
||||
|
||||
app.use(express.static(path.join(__dirname, 'build')));
|
||||
|
||||
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'));
|
||||
});
|
||||
|
||||
@@ -5,55 +5,35 @@ import valid from 'card-validator';
|
||||
import { isServer } from './store';
|
||||
import FileSaver from 'file-saver';
|
||||
import { emaildomains } from './constants/emaildomains';
|
||||
import axios from 'axios';
|
||||
|
||||
let apiUrl = 'http://localhost:3002';
|
||||
let dashboardUrl = null;
|
||||
let domain = null;
|
||||
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 if (window.location.href.indexOf('staging') > -1) {
|
||||
// apiUrl = 'https://staging-api.fyipe.com';
|
||||
// dashboardUrl = 'http://staging-dashboard.fyipe.com';
|
||||
// domain = 'fyipe.com';
|
||||
// } else {
|
||||
// apiUrl = 'https://api.fyipe.com';
|
||||
// dashboardUrl = 'https://dashboard.fyipe.com';
|
||||
// domain = 'fyipe.com';
|
||||
// }
|
||||
if (!isServer) {
|
||||
if (window.location.href.indexOf('localhost') > -1) {
|
||||
apiUrl = 'http://localhost:3002';
|
||||
dashboardUrl = 'http://localhost:3000';
|
||||
domain = 'localhost';
|
||||
adminDashboardUrl = 'http://localhost:3100';
|
||||
} else if (window.location.href.indexOf('accounts:3003') > -1) {
|
||||
apiUrl = 'http://backend:3002';
|
||||
dashboardUrl = 'http://dashboard:3000';
|
||||
domain = 'local';
|
||||
} else if (window.location.href.indexOf('staging') > -1) {
|
||||
apiUrl = 'https://staging-api.fyipe.com';
|
||||
dashboardUrl = 'http://staging-dashboard.fyipe.com';
|
||||
domain = 'fyipe.com';
|
||||
} else {
|
||||
apiUrl = 'https://api.fyipe.com';
|
||||
dashboardUrl = 'https://dashboard.fyipe.com';
|
||||
domain = 'fyipe.com';
|
||||
}
|
||||
|
||||
|
||||
// }
|
||||
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;
|
||||
|
||||
export const DASHBOARD_URL = dashboardUrl;
|
||||
|
||||
Reference in New Issue
Block a user