File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -151,21 +151,36 @@ func ConfigUnset(appID string, configVars []string) error {
151151
152152// ConfigPull pulls an app's config to a file.
153153func ConfigPull (appID string , interactive bool , overwrite bool ) error {
154- filename := ".env"
154+ c , appID , err := load ( appID )
155155
156- if ! overwrite {
157- if _ , err := os .Stat (filename ); err == nil {
158- return fmt .Errorf ("%s already exists, pass -o to overwrite" , filename )
159- }
156+ if err != nil {
157+ return err
160158 }
161159
162- c , appID , err := load ( appID )
160+ configVars , err := config . List ( c , appID )
163161
164162 if err != nil {
165163 return err
166164 }
167165
168- configVars , err := config .List (c , appID )
166+ stat , err := os .Stdout .Stat ()
167+
168+ if err != nil {
169+ return err
170+ }
171+
172+ if (stat .Mode () & os .ModeCharDevice ) == 0 {
173+ fmt .Print (formatConfig (configVars .Values ))
174+ return nil
175+ }
176+
177+ filename := ".env"
178+
179+ if ! overwrite {
180+ if _ , err := os .Stat (filename ); err == nil {
181+ return fmt .Errorf ("%s already exists, pass -o to overwrite" , filename )
182+ }
183+ }
169184
170185 if interactive {
171186 contents , err := ioutil .ReadFile (filename )
Original file line number Diff line number Diff line change @@ -121,7 +121,8 @@ func configPull(argv []string) error {
121121 usage := `
122122Extract all environment variables from an application for local use.
123123
124- Your environment will be stored locally in a file named .env. This file can be
124+ The environmental variables can be piped into a file, 'deis config:pull > file',
125+ or stored locally in a file named .env. This file can be
125126read by foreman to load the local environment for your app.
126127
127128Usage: deis config:pull [options]
You can’t perform that action at this time.
0 commit comments