Skip to content

Commit 6dbed3b

Browse files
author
Oliver Nordbjerg
committed
feat(client): add optional path to config:push
Implement #3423 allowing users to optionally specify a path to an environment file for config:push
1 parent 86b3b09 commit 6dbed3b

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

client/deis.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,6 +1176,7 @@ def config_set(self, args):
11761176
app = args.get('--app')
11771177
if not app:
11781178
app = self._session.app
1179+
11791180
values = dictify(args['<var>=<value>'])
11801181
if values.get('SSH_KEY'):
11811182
if os.path.isfile(values.get('SSH_KEY')):
@@ -1321,24 +1322,34 @@ def config_push(self, args):
13211322
"""
13221323
Sets environment variables for an application.
13231324
1324-
Your environment is read from a file named .env. This file can be
1325-
read by foreman to load the local environment for your app.
1325+
Your environment is read from the optionally specified path to a
1326+
.env-formatted file. If no path is specified, your environment is read
1327+
from a file named .env. This file can be read by foreman to load the
1328+
local environment for your app.
13261329
1327-
Usage: deis config:push [options]
1330+
Usage: deis config:push [<path>] [options]
1331+
1332+
Arguments:
1333+
<path>
1334+
a path leading to an environment file
13281335
13291336
Options:
13301337
-a --app=<app>
13311338
the uniquely identifiable name for the application.
13321339
"""
1340+
env_file = '.env'
1341+
if args.get('<path>'):
1342+
env_file = args.get('<path>')
13331343
app = args.get('--app')
13341344
if not app:
13351345
app = self._session.app
1346+
13361347
# read from .env
13371348
try:
1338-
with open('.env', 'r') as f:
1349+
with open(env_file, 'r') as f:
13391350
self._config_set(app, dictify([line.strip() for line in f]))
13401351
except IOError:
1341-
self._logger.error('could not read from local env')
1352+
self._logger.error('could not read env from ' + env_file)
13421353
sys.exit(1)
13431354

13441355
def domains(self, args):

0 commit comments

Comments
 (0)