legacy-cli
legacy-cli copied to clipboard
PLATFORMSH_CLI_TOKEN per project
I'm managing projects from multiple Platform.sh accounts. Each time I need to switch to projects from another account, I have to logout from the CLI, and log back again with the account I need for that project.
One potential solution I can think of using the CLI tokens per project to authenticate them, without really logging out.
Could PLATFORMSH_CLI_TOKEN be defined per project and used for such scenario? Or is there already a working solution for such issue?
Thanks, Osman
That's an interesting use case.
If you're logged in without tokens, there is something else you can use, which is the PLATFORMSH_CLI_SESSION_ID variable. This namespaces your login session. The default value is default
, but you could use this one-liner inside any Git repository to set it to that repository's path:
export PLATFORMSH_CLI_SESSION_ID="$(git rev-parse --show-toplevel)"
Each time you wanted to switch between sessions, you would cd path/to/repo
and then run the above command. You can then log in normally, and it'll keep your session for next time. Does that help?