36 lines
794 B
JavaScript
36 lines
794 B
JavaScript
const config = {
|
|
port: parseInt(process.env.PORT, 10) || 8888,
|
|
|
|
baseDomain: process.env.BASE_DOMAIN || '',
|
|
|
|
projectPortStart: parseInt(process.env.PROJECT_PORT_START, 10) || 9000,
|
|
projectPortEnd: parseInt(process.env.PROJECT_PORT_END, 10) || 9100,
|
|
|
|
getProjectUrl(port, projectPath = '') {
|
|
let baseUrl;
|
|
if (this.baseDomain) {
|
|
baseUrl = `http://${this.baseDomain}:${port}`;
|
|
} else {
|
|
baseUrl = `http://localhost:${port}`;
|
|
}
|
|
|
|
if (projectPath) {
|
|
return `${baseUrl}${projectPath}`;
|
|
}
|
|
return baseUrl;
|
|
},
|
|
|
|
getBaseUrl() {
|
|
if (this.baseDomain) {
|
|
return `http://${this.baseDomain}`;
|
|
}
|
|
return `http://localhost:${this.port}`;
|
|
},
|
|
|
|
isProduction() {
|
|
return !!this.baseDomain;
|
|
}
|
|
};
|
|
|
|
module.exports = config;
|