|
@@ -20,32 +20,11 @@ class ProjectEnvironment {
|
|
|
}
|
|
|
|
|
|
_setEnvironment(env) {
|
|
|
- if (
|
|
|
- !this._loadConfigFile() ||
|
|
|
- !this._loadDockerComposeFile()
|
|
|
- ) {
|
|
|
+ if (!this._loadDockerComposeFile()) {
|
|
|
throw [`Unable to load %s environment`, colors.bold(env)];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- _loadConfigFile() {
|
|
|
- const configFilename = `config.${this._env}.json`;
|
|
|
- const configFilepath = path.join(this._cwd, configFilename);
|
|
|
-
|
|
|
- if (!fs.existsSync(configFilepath)) {
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- try {
|
|
|
- const config = JSON.parse(fs.readFileSync(configFilepath, 'utf8'));
|
|
|
- this._config = config;
|
|
|
- } catch (ex) {
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
_loadDockerComposeFile() {
|
|
|
const dockerComposeFilename = `docker-compose.${this._env}.yml`;
|
|
|
const dockerComposeFilepath = path.join(this._cwd, dockerComposeFilename);
|
|
@@ -91,10 +70,6 @@ class ProjectEnvironment {
|
|
|
return this._env;
|
|
|
}
|
|
|
|
|
|
- getHosts() {
|
|
|
- return this._config['hosts'] || {};
|
|
|
- }
|
|
|
-
|
|
|
async getServices() {
|
|
|
const data = await docker.configServices({ ...this.getDockerOptions(), ...{ log: false } });
|
|
|
|