Skip to content

Commit

Permalink
FIX BUGS: commands option #21
Browse files Browse the repository at this point in the history
  • Loading branch information
anak10thn committed Jun 2, 2017
1 parent 6feadec commit 83f27c6
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions lib/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ module.exports = {
var opt = keyMap.opt.join(" ");
var img = keyMap.img;
var name = keyMap.name;
var exec = keyMap.cmd;
var exec = ""
if(typeof(keyMap.cmd) == "object"){
exec = keyMap.cmd.join(" ");
}
var cmd = "docker service create "+opt+" --name "+name+" "+img+" "+exec;
//console.log(cmd);
chp.exec(cmd,(e, stdout, stderr)=> {
Expand All @@ -71,7 +74,7 @@ module.exports = {
var app = val.services[key];
var image = app.image;
var opt = module.exports.opt(app);
if(command) var cmd

var keyMap = {
opt: opt,
img: image,
Expand All @@ -83,10 +86,14 @@ module.exports = {
opt : (app)=>{
var arr = [];
var cmd = utils.obj(app);
command = "";
if(cmd.indexOf("command") >= 0){
command = app.command;

if(cmd.indexOf("commands") >= 0){
command = app.commands;
}
else{
command = ""
}

if(cmd.indexOf("volumes") >= 0){
app.volumes.forEach((v)=>{
if(!volumes[v]){
Expand Down

0 comments on commit 83f27c6

Please sign in to comment.