diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 00000000..5c540855 Binary files /dev/null and b/.DS_Store differ diff --git a/cmd/cmd.go b/cmd/cmd.go index 3af972df..82cb560a 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -40,7 +40,7 @@ type Commander interface { ConfigSet(string, []string) error ConfigUnset(string, []string) error ConfigPull(string, bool, bool) error - ConfigPush(string, string) error + ConfigPush(string, string, bool) error DomainsList(string, int) error DomainsAdd(string, string) error DomainsRemove(string, string) error diff --git a/cmd/config.go b/cmd/config.go index a2ff3a7d..24cdbfc9 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -235,7 +235,7 @@ func (d *DeisCmd) ConfigPull(appID string, interactive bool, overwrite bool) err } // ConfigPush pushes an app's config from a file. -func (d *DeisCmd) ConfigPush(appID, fileName string) error { +func (d *DeisCmd) ConfigPush(appID, fileName string, verbose bool) error { stat, err := os.Stdin.Stat() if err != nil { @@ -243,12 +243,20 @@ func (d *DeisCmd) ConfigPush(appID, fileName string) error { } var contents []byte - - if (stat.Mode() & os.ModeCharDevice) == 0 { + if ((stat.Mode()&os.ModeNamedPipe) != 0 || stat.Size() > 0) && fileName == ".no-file" { + if verbose { + d.Println("Getting input from stdin") + } buffer := new(bytes.Buffer) buffer.ReadFrom(os.Stdin) contents = buffer.Bytes() } else { + if verbose { + d.Println("Not getting input from stdin") + } + if fileName == ".no-file" { + fileName = ".env" + } contents, err = ioutil.ReadFile(fileName) if err != nil { diff --git a/parser/config.go b/parser/config.go index 364edb10..abfb94ed 100644 --- a/parser/config.go +++ b/parser/config.go @@ -176,9 +176,11 @@ Usage: deis config:push [options] Options: -a --app= - the uniquely identifiable name for the application. + The uniquely identifiable name for the application. -p , --path= - a path leading to an environment file [default: .env] + A path leading to an environment file [default: .no-file] + -v --verbose + Show debug output ` args, err := docopt.Parse(usage, argv, true, "", false, true) @@ -189,6 +191,7 @@ Options: app := safeGetValue(args, "--app") path := safeGetValue(args, "--path") + verbose := args["--verbose"].(bool) - return cmdr.ConfigPush(app, path) + return cmdr.ConfigPush(app, path, verbose) } diff --git a/parser/config_test.go b/parser/config_test.go index fc7342cb..28be852e 100644 --- a/parser/config_test.go +++ b/parser/config_test.go @@ -28,7 +28,7 @@ func (d FakeDeisCmd) ConfigPull(string, bool, bool) error { return errors.New("config:pull") } -func (d FakeDeisCmd) ConfigPush(string, string) error { +func (d FakeDeisCmd) ConfigPush(string, string, bool) error { return errors.New("config:push") }