OpenShift rhc setup using multiple accounts
I have two accounts on Openshift platform. How can I setup my computer so that I can manage both of them with rhc
? I cannot find any relevant option in the command line arguments.
The rhc
command-line tools come with the global option -l, --rhlogin LOGIN
. You have two options:
-
Use the
-l
flag with every command to specify the login name:rhc app create <appname> <cartridge> [-l <login1/login2>]
-
Run
rhc setup -l LOGIN
between the sessions. Once done managing apps from one account you can end the session for it by runningrhc account logout
.rhc setup -l <login1> # First account's login rhc app create <appname> <cartridge> rhc logout rhc setup -l <login2> # Second account's login rhc app create <appname> <cartridge> rhc logout
When you can rhc setup
command, the username information gets stored in .openshift/express.conf
file; hence the need to run it again when you want to switch the account.
The command line also supports --conf
- where you pass a file. You can always alias the command via a shell script.
Quite old question, but I use yet another solution which seems to be more comfortable (at least for me) - the environment variable OPENSHIFT_CONFIG
.
The OPENSHIFT_CONFIG
environment variable can be used to override the OpenShift configuration name (by default "express"). When set the operations performed with rhc refers to ~/.openshift/${OPENSHIFT_CONFIG}.conf
(instead of ~/.openshift/express.conf
).
To switch to the another OpenShift account the following could be used (Bash):
export OPENSHIFT_CONFIG=thenewone
rhc apps //apps on the new account
...
unset OPENSHIFT_CONFIG
rhc apps //apps on the default account
Verified with rhc 1.37.1, but should work with any version released after May 2013.