Enhanced Google Cloud SDK configuration management tool with interactive selection and bulk operations.
- Interactive Switching: Switch between gcloud configurations using fzf's fuzzy finder
- Bulk Export: Export configurations to YAML format for backup or migration
- Bulk Import: Import configurations from YAML files to quickly set up environments
- List Configurations: Display all available configurations in a formatted table
go install github.com/nek023/gconfig@latestgit clone https://github.com/nek023/gconfig.git
cd gconfig
go build -o gconfig .- Go 1.26.0 or higher
- gcloud CLI installed and configured
- fzf (required for interactive switching)
Interactively switch between gcloud configurations using fzf.
# Show all configurations and select interactively
gconfig switch
# Start with a search query
gconfig switch prod
# Filter configurations containing specific text
gconfig switch my-projectThe currently active configuration is highlighted in red for easy identification.
Export gcloud configurations to YAML format.
# Export all configurations
gconfig export
# Export a specific configuration
gconfig export my-config
# Save to a file
gconfig export > configs.yaml
# Export specific configuration to file
gconfig export production > prod-config.yamlImport configurations from YAML files.
# Import from file
gconfig import configs.yaml
# Import from stdin
cat configs.yaml | gconfig import
# Import from URL
curl -s https://example.com/configs.yaml | gconfig importDisplay all available gcloud configurations.
# List all configurations
gconfig list
# Filter output (using standard Unix tools)
gconfig list | grep prod# Backup all configurations
gconfig export > backup-$(date +%Y%m%d).yaml
# Restore configurations
gconfig import backup-20240101.yaml# On source machine
gconfig export > my-configs.yaml
# Transfer file to target machine, then:
gconfig import my-configs.yaml# Export team configurations
gconfig export > team-configs.yaml
# Team members can import
gconfig import team-configs.yaml# Copy configuration from one machine to another via SSH
gconfig export my-config | ssh user@remote-host 'gconfig import'The YAML format used for import/export follows the gcloud configuration structure:
name: my-configuration
properties:
core:
account: user@example.com
project: my-gcp-project
compute:
region: us-central1
zone: us-central1-aMultiple configurations can be stored in a single file using YAML document separators (---).
| Command | Description |
|---|---|
gconfig switch [query] |
Switch configuration interactively |
gconfig export [config] |
Export configuration(s) to YAML |
gconfig import [file] |
Import configurations from YAML |
gconfig list |
List all configurations |
gconfig help |
Show help information |
- Use
gconfig switchwith partial configuration names for quick filtering - Combine
gconfig exportwith version control to track configuration changes - Create configuration templates for different environments (dev, staging, prod)
- Use shell aliases for frequently used configurations:
alias gcprod='gconfig switch production' alias gcdev='gconfig switch development'
go build -o gconfig .go test ./...gofmt -w .gconfig acts as a wrapper around the gcloud CLI, providing enhanced functionality while maintaining compatibility with existing gcloud configurations. It does not store any configuration data itself but operates directly on gcloud's configuration files.
- cmd/: Cobra-based CLI commands
- internal/gcloud/: Interface for gcloud CLI operations
- internal/fzf/: Interactive selection functionality
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.