@supercorks/gswitch
v1.1.0
Published
Switch Google Cloud configurations and application default credentials
Maintainers
Readme
gswitch
A CLI tool to seamlessly switch between Google Cloud configurations and update application default credentials.
Installation
Using npx (no installation required)
npx @supercorks/gswitchGlobal Installation
npm install -g @supercorks/gswitch
gswitchUsage
Switch accounts
# Interactive mode - select from available configurations
gswitch
# Direct switch by configuration name
gswitch personalAfter switching, gswitch prints the configuration alias and the active account email, plus the current project.
List configurations
gswitch list
# or
gswitch lsShows all configurations with their associated email addresses.
Add a new account
gswitch new
# Or with arguments:
gswitch new personal [email protected]This guides you through the entire setup process:
- Login with the new account
- Create and activate a gcloud configuration
- Set up application default credentials
Running gswitch new on an existing configuration will refresh the credentials without recreating the configuration.
Switch projects
gswitch projectInteractively select a project from your available GCP projects. The current project is highlighted in the list, and projects show their organization name in parentheses when available.
How it works
When you switch accounts, gswitch automatically:
- Activates the specified gcloud configuration
- Updates your
application_default_credentials.jsonby copying fromapplication_default_credentials_<account>.json - Displays the current project and suggests
gswitch projectto change it
If the saved ADC file for that configuration is missing, gswitch will show a warning and the exact gcloud command to regenerate it.
