Skip to content

Commit

Permalink
Merge pull request deis#3526 from onbjerg/client-dotenv
Browse files Browse the repository at this point in the history
feat(client): add optional path to config:push
  • Loading branch information
mboersma committed Apr 21, 2015
2 parents ebcc410 + e7d96e3 commit c32b775
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions client/deis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1182,6 +1182,7 @@ def config_set(self, args):
app = args.get('--app')
if not app:
app = self._session.app

values = dictify(args['<var>=<value>'])
if values.get('SSH_KEY'):
if os.path.isfile(values.get('SSH_KEY')):
Expand Down Expand Up @@ -1327,24 +1328,27 @@ def config_push(self, args):
"""
Sets environment variables for an application.
Your environment is read from a file named .env. This file can be
read by foreman to load the local environment for your app.
The environment is read from <path>. This file can be read by foreman
to load the local environment for your app.
Usage: deis config:push [options]
Options:
-a --app=<app>
the uniquely identifiable name for the application.
-p <path>, --path=<path>
a path leading to an environment file [default: .env]
"""
app = args.get('--app')
if not app:
app = self._session.app

# read from .env
try:
with open('.env', 'r') as f:
with open(args.get('--path'), 'r') as f:
self._config_set(app, dictify([line.strip() for line in f]))
except IOError:
self._logger.error('could not read from local env')
self._logger.error('could not read env from ' + args.get('--path'))
sys.exit(1)

def domains(self, args):
Expand Down

0 comments on commit c32b775

Please sign in to comment.