Skip to content

Commit 20f6a94

Browse files
author
Matthew Fisher
committed
Merge pull request #3367 from a-saad/client-multiple-profiles
feat(client): Add multiple profile support to the client
2 parents 58bf854 + 2f29bcf commit 20f6a94

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

client/deis.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ def __init__(self):
172172
# Create the $HOME/.deis dir if it doesn't exist
173173
if not os.path.isdir(path):
174174
os.mkdir(path, 0700)
175-
self._path = os.path.join(path, 'client.json')
175+
filename = '%s.json' % os.environ.get('DEIS_PROFILE', 'client')
176+
self._path = os.path.join(path, filename)
176177
if not os.path.exists(self._path):
177178
settings = {}
178179
with open(self._path, 'w') as f:

docs/using_deis/install-client.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,21 @@ To get help on subcommands, use ``deis help [subcommand]``:
7878
7979
.. _pip: http://www.pip-installer.org/en/latest/installing.html
8080
.. _Python: https://www.python.org/
81+
82+
Multiple Profile Support
83+
------------------------
84+
85+
The Deis client supports running commands against multiple installations
86+
and/or accounts by setting the ``$DEIS_PROFILE`` environment variable
87+
before logging in and running any subsequent commands. If not set, all
88+
commands will default to the ``client`` profile which maps to
89+
a configuration file at ``$HOME/.deis/client.json``. Here's an example
90+
of running the ps command against an app with the same name from two profiles:
91+
92+
93+
.. code-block:: console
94+
95+
$ DEIS_PROFILE=production deis ps -a helloworld
96+
$ DEIS_PROFILE=staging deis ps -a helloworld
97+
98+

0 commit comments

Comments
 (0)