This repository has been archived on 2021-03-10. You can view files and clone it, but cannot push or open issues or pull requests.
perktree/frontend/src/config/index.js

23 lines
335 B
JavaScript

import {
API_ROUTE,
ENVIRONMENTS,
BACKEND_HOSTNAMES,
} from './constants';
const config = {
getEnv() {
return ENVIRONMENTS[window.location.hostname] || 'dev';
},
getHostName() {
return BACKEND_HOSTNAMES[this.getEnv()];
},
getApiUrl() {
return this.getHostName() + API_ROUTE;
},
};
export { config };