Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
feat(client): add deis config:push
Browse files Browse the repository at this point in the history
This new feature reads from a local .env and pushes the environment
variables to Deis.
  • Loading branch information
Matthew Fisher committed Mar 26, 2015
1 parent 6a235ad commit 1fd7b59
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions client/deis.py
Expand Up @@ -984,6 +984,7 @@ def config(self, args):
config:set set environment variables for an app
config:unset unset environment variables for an app
config:pull extract environment variables to .env
config:push set environment variables from .env
Use `deis help [command]` to learn more.
"""
Expand Down Expand Up @@ -1184,6 +1185,30 @@ def config_pull(self, args):
else:
raise ResponseError(response)

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.
Usage: deis config:push [options]
Options:
-a --app=<app>
the uniquely identifiable name for the application.
"""
app = args.get('--app')
if not app:
app = self._session.app
# read from .env
try:
with open('.env', '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')
sys.exit(1)

def domains(self, args):
"""
Valid commands for domains:
Expand Down

0 comments on commit 1fd7b59

Please sign in to comment.