Configuring the PipeOps CLI
The PipeOps CLI can be configured to suit your workflow through configuration files, environment variables, and command-line flags.
Configuration File
The CLI stores its configuration in a JSON file located at:
~/.pipeops.json
Configuration File Structure
{
"api_url": "https://api.pipeops.io",
"auth_token": "your-auth-token",
"default_project": "my-project",
"output_format": "text",
"log_level": "info"
}
Configuration Options
| Option | Description | Default |
|---|---|---|
api_url | PipeOps API endpoint | https://api.pipeops.io |
auth_token | Authentication token (set by auth login) | - |
default_project | Default project for commands | - |
output_format | Output format (text, json) | text |
log_level | Logging level (debug, info, warn, error) | info |
Editing Configuration
You can manually edit the configuration file:
# Open in default editor
$EDITOR ~/.pipeops.json
# Or use a specific editor
nano ~/.pipeops.json
vim ~/.pipeops.json
Environment Variables
Environment variables override configuration file settings.
Available Environment Variables
PIPEOPS_CONFIG_PATH
Specify a custom location for the configuration file:
export PIPEOPS_CONFIG_PATH=/path/to/custom/config.json
pipeops auth login
PIPEOPS_API_URL
Override the API endpoint:
export PIPEOPS_API_URL=https://api.staging.pipeops.io
pipeops project list
This is useful for:
- Testing against staging environments
- Using self-hosted PipeOps instances
- Development and debugging
PIPEOPS_LOG_LEVEL
Set the logging verbosity:
export PIPEOPS_LOG_LEVEL=debug
pipeops status proj-123
Available levels:
debug: Detailed debugging informationinfo: General informational messages (default)warn: Warning messages onlyerror: Error messages only
PIPEOPS_AUTH_TOKEN
Provide authentication token directly:
export PIPEOPS_AUTH_TOKEN=your-token-here
pipeops project list
Be careful when using this in scripts. Never commit tokens to version control.
PIPEOPS_NO_COLOR
Disable colored output:
export PIPEOPS_NO_COLOR=1
pipeops project list
PIPEOPS_OUTPUT_FORMAT
Set default output format:
export PIPEOPS_OUTPUT_FORMAT=json
pipeops project list
Global Flags
Global flags can be used with any command and override both configuration file and environment variables.
--json
Output in JSON format:
pipeops list --json
Example output:
[
{
"id": "proj_123",
"name": "my-app",
"status": "running",
"url": "https://my-app.pipeops.io"
}
]
--verbose / -v
Enable verbose output:
pipeops status proj-123 --verbose
This shows:
- HTTP requests and responses
- Detailed operation steps
- Timing information
--quiet / -q
Suppress non-essential output:
pipeops list --quiet
Only errors and critical information will be displayed.
--help / -h
Display help information:
pipeops --help
pipeops list --help
pipeops status --help
--version
Display CLI version:
pipeops --version
--config
Specify a custom configuration file:
pipeops --config /path/to/config.json project list
Configuration Precedence
Configuration values are resolved in the following order (highest to lowest priority):
- Command-line flags (highest priority)
- Environment variables
- Configuration file
- Default values (lowest priority)
Example
# Configuration file has log_level: "info"
# Environment variable sets LOG_LEVEL=warn
# Command-line flag uses --verbose (debug)
# Result: debug level is used
export PIPEOPS_LOG_LEVEL=warn
pipeops project list --verbose
Multiple Environments
Manage multiple PipeOps environments using different configuration files:
Production Environment
# ~/.pipeops.production.json
{
"api_url": "https://api.pipeops.io",
"default_project": "production-app"
}
Use with:
export PIPEOPS_CONFIG_PATH=~/.pipeops.production.json
pipeops project list
Staging Environment
# ~/.pipeops.staging.json
{
"api_url": "https://api.staging.pipeops.io",
"default_project": "staging-app"
}
Use with:
export PIPEOPS_CONFIG_PATH=~/.pipeops.staging.json
pipeops project list
Using Aliases
Create shell aliases for different environments:
# Add to ~/.bashrc or ~/.zshrc
alias pipeops-prod='PIPEOPS_CONFIG_PATH=~/.pipeops.production.json pipeops'
alias pipeops-staging='PIPEOPS_CONFIG_PATH=~/.pipeops.staging.json pipeops'
Usage:
pipeops-prod list
pipeops-staging status proj-123
Authentication Configuration
Login Flow
When you run pipeops auth login, the CLI:
- Opens your browser for OAuth authentication
- Receives an authorization code
- Exchanges it for an access token
- Saves the token to
~/.pipeops.json
Token Storage
The authentication token is stored securely in the configuration file:
{
"auth_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
Manual Token Configuration
For CI/CD or automated environments, you can set the token manually:
# Using environment variable (recommended for CI/CD)
export PIPEOPS_AUTH_TOKEN="your-token-here"
# Or add to configuration file
echo '{"auth_token":"your-token-here"}' > ~/.pipeops.json
For CI/CD pipelines, use secrets management to store tokens securely.
Token Refresh
Tokens are automatically refreshed by the CLI. If authentication expires:
pipeops auth login
Project-Specific Configuration
Set a default project to avoid specifying it in every command:
In Configuration File
{
"default_project": "my-app"
}
Using Environment Variable
export PIPEOPS_DEFAULT_PROJECT=proj-123
pipeops status
Commands without --project flag
Once set, you can omit the --project flag:
# Instead of
pipeops status proj-123
# You can use
pipeops status
Output Customization
Text Output (Default)
Human-readable formatted output:
pipeops project list
Output:
NAME STATUS UPDATED URL
my-app running 2024-01-15 10:30:00 https://my-app.pipeops.io
other-app stopped 2024-01-14 15:20:00 https://other-app.pipeops.io
JSON Output
Machine-readable JSON output:
pipeops project list --json
Output:
[
{
"name": "my-app",
"status": "running",
"updated": "2024-01-15T10:30:00Z",
"url": "https://my-app.pipeops.io"
}
]
Using with jq
Process JSON output with jq:
# Get project names only
pipeops project list --json | jq -r '.[].name'
# Filter running projects
pipeops project list --json | jq '.[] | select(.status=="running")'
# Count projects
pipeops project list --json | jq 'length'
Logging Configuration
Log Levels
Configure logging verbosity:
# In configuration file
{
"log_level": "debug"
}
# Or use environment variable
export PIPEOPS_LOG_LEVEL=debug
# Or use command flag
pipeops --verbose project list
Log Output
By default, logs are written to stderr. Redirect as needed:
# Save logs to file
pipeops project list 2> debug.log
# Separate output and logs
pipeops project list > output.txt 2> errors.log
Proxy Configuration
If you're behind a proxy, configure it using standard environment variables:
export HTTP_PROXY=http://proxy.example.com:8080
export HTTPS_PROXY=http://proxy.example.com:8080
export NO_PROXY=localhost,127.0.0.1
pipeops project list
Proxy Authentication
For proxies requiring authentication:
export HTTP_PROXY=http://username:password@proxy.example.com:8080
export HTTPS_PROXY=http://username:password@proxy.example.com:8080
Configuration Best Practices
Security
-
Protect your configuration file:
chmod 600 ~/.pipeops.json -
Never commit configuration files to version control:
# Add to .gitignore
echo ".pipeops.json" >> .gitignore -
Use environment variables in CI/CD:
- Don't store tokens in configuration files in CI/CD
- Use your CI/CD platform's secrets management
Organization
- Use separate configurations for different environments
- Document your configuration in team wikis or README files
- Use consistent naming for projects and environments
Performance
- Set a default project if you work primarily on one project
- Use JSON output for scripting to avoid parsing text
- Adjust log levels based on your needs (use
errororwarnin production scripts)
Troubleshooting Configuration
Configuration File Not Found
If the CLI can't find the configuration file:
# Create directory
mkdir -p ~/.pipeops
# Create configuration file
echo '{}' > ~/.pipeops.json
Invalid Configuration
If the configuration file is corrupted:
# Backup existing file
mv ~/.pipeops.json ~/.pipeops.json.backup
# Create new configuration
pipeops auth login
Environment Variable Not Working
Check if the variable is set:
echo $PIPEOPS_API_URL
Ensure it's exported:
export PIPEOPS_API_URL=https://api.pipeops.io
Clear All Configuration
To start fresh:
rm ~/.pipeops.json
pipeops auth login
Next Steps
- Commands Overview: Learn about available commands
- Advanced Usage: Docker and CI/CD integration
- Troubleshooting: Common issues and solutions