Skip to content

Commit 1fd7b59

Browse files
author
Matthew Fisher
committed
feat(client): add deis config:push
This new feature reads from a local .env and pushes the environment variables to Deis.
1 parent 6a235ad commit 1fd7b59

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

client/deis.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -984,6 +984,7 @@ def config(self, args):
984984
config:set set environment variables for an app
985985
config:unset unset environment variables for an app
986986
config:pull extract environment variables to .env
987+
config:push set environment variables from .env
987988
988989
Use `deis help [command]` to learn more.
989990
"""
@@ -1184,6 +1185,30 @@ def config_pull(self, args):
11841185
else:
11851186
raise ResponseError(response)
11861187

1188+
def config_push(self, args):
1189+
"""
1190+
Sets environment variables for an application.
1191+
1192+
Your environment is read from a file named .env. This file can be
1193+
read by foreman to load the local environment for your app.
1194+
1195+
Usage: deis config:push [options]
1196+
1197+
Options:
1198+
-a --app=<app>
1199+
the uniquely identifiable name for the application.
1200+
"""
1201+
app = args.get('--app')
1202+
if not app:
1203+
app = self._session.app
1204+
# read from .env
1205+
try:
1206+
with open('.env', 'r') as f:
1207+
self._config_set(app, dictify([line.strip() for line in f]))
1208+
except IOError:
1209+
self._logger.error('could not read from local env')
1210+
sys.exit(1)
1211+
11871212
def domains(self, args):
11881213
"""
11891214
Valid commands for domains:

0 commit comments

Comments
 (0)