Skip to content

Commit

Permalink
Add env variables replacement in "project_name" configuration parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Nitro-N committed Jan 23, 2022
1 parent 5f8475c commit 68a0558
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
4 changes: 3 additions & 1 deletion command-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ CommandBuilder.prototype._build = function () {

result = 'docker-compose';

result += ' -p ' + this.projectName;
if (this.projectName) {
result += ' -p ' + this.projectName;
}

var i;

Expand Down
17 changes: 13 additions & 4 deletions jake.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ try {
var envConfig = config.environtments[env];
var envReplace = require('./env-replace');

if ('project_name' in config) {
systemEnv.JAKE_PROJECT_NAME = config.project_name;
var projectName = systemEnv.JAKE_PROJECT_NAME || (config.project_name ? envReplace(config.project_name) : null);
var aliases = config.aliases || {};

if (projectName !== systemEnv.JAKE_PROJECT_NAME) {
systemEnv.JAKE_PROJECT_NAME = projectName;
}

for (var i = 0; i < envConfig.vars.length; i++) {
Expand Down Expand Up @@ -87,10 +90,16 @@ try {
commandBuilder
.setContainer(args.container)
.setCmd(args.docker_compose, args.cmd)
.setAliases(config.aliases)
.setProjectName(config.project_name)
.setEnv(env);

if (aliases) {
commandBuilder.setAliases(aliases);
}

if (projectName) {
commandBuilder.setProjectName(projectName);
}

var interactive = envConfig.docker.interactive || args.interactive;
var tty = envConfig.docker.tty || args.tty || process.stdout.isTTY;

Expand Down

0 comments on commit 68a0558

Please sign in to comment.