drpcli Configuration¶
The drpcli command-line tool provides multiple ways to configure endpoint connections, authentication credentials, and
output preferences. This guide covers all configuration methods and explains how they interact.
For general CLI usage, see drpcli Usage.
Quick Start: Setting Up Your First Profile¶
If you're new to drpcli, here's how to get started with config profiles:
# 1. Create your .drpclirc file with your settings
cat > ~/.drpclirc << 'EOF'
RS_ENDPOINT=https://prod-drp.example.com:8092
RS_USERNAME=admin
RS_PASSWORD=your_password
EOF
# 2. Save it as a named profile (this also activates the profile)
drpcli config save prod
# 3. Verify it's active (the * indicates current profile)
drpcli config list
# Output:
* prod
Configuration Methods¶
There are four ways to configure drpcli:
- Command-line flags — Passed directly to each command
- Config profiles — Managed via
drpcli configcommands - The
.drpclircfile — A persistent configuration file in your home directory - Environment variables — Set in your shell environment
Precedence Order¶
When a setting is defined in multiple places, drpcli applies them in this order (highest priority first):
- Command-line flags (always win)
.drpclircfile- Environment variables
- Built-in defaults (these are default values hardcoded in the code)
For example, if you set RS_ENDPOINT in an environment variable and also have it in your .drpclirc file, the
.drpclirc value will be used. However, if you also pass -E on the command line, that value takes precedence over
both.
Config Profiles¶
Config profiles allow you to save and switch between multiple configurations.
How Profiles Work¶
Profiles are stored as files in $HOME/.drpcli/. The $HOME/.drpclirc file always contains your active
configuration—it's what drpcli reads when running commands.
~/.drpclirc— Your "working" config (always in use)~/.drpcli/[name]— Saved snapshots you can switch between
The RS_PROFILE setting in .drpclirc tracks which profile is currently active.
Available Commands¶
| Command | Description |
|---|---|
drpcli config list |
List all saved profiles (active profile marked with *) |
drpcli config save [name] |
Save current .drpclirc as a named profile and activate it |
drpcli config switch [name] |
Load a saved profile into .drpclirc, making it active |
drpcli config show [name] |
Display contents of a named profile (or .drpclirc if no name given) |
drpcli config set [field] [value] |
Set a field in .drpclirc and the active profile (if any) |
drpcli config remove [name] |
Delete a saved profile |
Command Details¶
drpcli config save [name]
Saves your current configuration as a named profile and immediately activates it.
How it works:
- Reads your current
~/.drpclirc - Sets
RS_PROFILE=[name]to mark it as the active profile - Writes to both
~/.drpcli/[name]and~/.drpclirc
After saving, both files are identical and you're now "on" that profile.
Note
When you save a new profile, it inherits all settings from your current .drpclirc.
Warning
The [name] argument you pass to save always takes precedence over any existing RS_PROFILE in your .drpclirc. For example, if you're currently on prod and run drpcli config save staging, you will immediately switch to staging—the command does not update the prod profile. To update your current profile in place, use drpcli config set instead.
drpcli config set [field] [value]
Updates a configuration field. If a profile is active (i.e., RS_PROFILE is set), the change is written to both
.drpclirc and the profile file.
Warning
Because set modifies both .drpclirc and the active profile, be careful not to accidentally overwrite a profile you didn't intend to change. Use drpcli config list to verify which profile is active before making changes.
drpcli config switch [name]
Loads a saved profile, making it your active configuration. The switched profile becomes your active configuration immediately.
drpcli config list
Shows all saved profiles. The currently active profile is marked with an asterisk (*).
drpcli config show [name]
Displays the contents of a profile without switching to it. If no name is provided, shows the current .drpclirc.
# Show a specific profile
drpcli config show staging
# Show current active config
drpcli config show
drpcli config remove [name]
Deletes a saved profile from ~/.drpcli/. This does not affect .drpclirc or your current configuration.
Note
Removing a profile only removes the saved profile. If you remove the currently active profile, your .drpclirc remains unchanged.
Example Workflow: Managing Multiple Environments¶
Here's a complete workflow for setting up and managing profiles for production, staging, and development environments:
# Start by configuring your production environment
cat > ~/.drpclirc << 'EOF'
RS_ENDPOINT=https://prod-drp.example.com:8092
RS_USERNAME=admin
RS_PASSWORD=prod_password
RS_FORMAT=json
EOF
# Save it as "prod" (this activates the prod profile)
drpcli config save prod
# Output: Saved config /home/user/.drpcli/prod
# Check current status
drpcli config list
# Output:
# * prod
# Create a staging profile based on prod, then modify it
drpcli config save staging
drpcli config set RS_ENDPOINT https://staging-drp.example.com:8092
drpcli config set RS_PASSWORD staging_password
# Verify staging was updated
drpcli config show staging
# Output:
# RS_PROFILE=staging
# RS_ENDPOINT=https://staging-drp.example.com:8092
# RS_USERNAME=admin
# RS_PASSWORD=staging_password
# RS_FORMAT=json
# Check status - we're now on staging
drpcli config list
# Output:
# prod
# * staging
# Switch back to production
drpcli config switch prod
# Output: Profile switched to prod
# Run commands against production
drpcli machines list
# Switch to staging for testing
drpcli config switch staging
drpcli machines list
# View prod settings without switching
drpcli config show prod
The .drpclirc File¶
The .drpclirc file provides persistent configuration without exposing credentials in your shell history or process
listings. It is located at $HOME/.drpclirc.
For additional information about the .drpclirc file, see Using the .drpclirc File.
Format¶
The file uses a simple KEY=value format, one setting per line.
RS_ENDPOINT=https://10.10.10.10:8092
RS_USERNAME=admin
RS_PASSWORD=super_secure_secret_password
RS_FORMAT=table
Warning
- Do not use
exportin front of variables - Do not surround values with quotes
- One setting per line
Command-Line Flags¶
Command-line flags provide one-time overrides and always take the highest precedence.
Warning
Command-line arguments may be visible in process listings (ps) and shell history.
Environment Variables¶
# Temporary override for a single command
RS_ENDPOINT=https://other-drp:8092 drpcli machines list
# Export for current shell session
export RS_ENDPOINT=https://drp.example.com:8092
export RS_KEY=admin:password
drpcli machines list
Configuration Settings Reference¶
The following settings can be configured via command-line flags, environment variables, or the .drpclirc file.
| Flag | Env / .drpclirc |
Description | Default |
|---|---|---|---|
-E, --endpoint |
RS_ENDPOINT |
DRP API endpoint URL | https://127.0.0.1:8092 |
RS_ENDPOINTS |
Space-separated list of endpoints to try | ||
-D, --download-proxy |
RS_DOWNLOAD_PROXY |
HTTP proxy for downloading catalog and content | |
-u, --url-proxy |
RS_URL_PROXY |
URL proxy for passing actions through another DRP | |
--force-new-session |
RS_FORCE_NEW_SESSION |
Always create a new session | false |
--ignore-unix-proxy |
RS_IGNORE_UNIX_PROXY |
Ignore unix domain socket proxy | false |
RS_LOCAL_PROXY |
Path to local unix socket proxy | ||
-U, --username |
RS_USERNAME |
Username for authentication | rocketskates |
-P, --password |
RS_PASSWORD |
Password for authentication | r0cketsk8ts |
RS_KEY |
Combined username:password pair |
rocketskates:r0cketsk8ts |
|
-T, --token |
RS_TOKEN |
Pre-created authentication token | |
--client-cert |
RS_CLIENT_CERT |
Path to client certificate for mutual TLS | |
--client-key |
RS_CLIENT_KEY |
Path to client private key for mutual TLS | |
--ca-cert |
RS_CA_CERT |
Path to additional CA certificate | |
--server-verify |
RS_SERVER_VERIFY |
Verify server certificate (true/false) |
false |
-x, --no-token |
Disable token authentication and token caching | false |
|
RS_TOKEN_CACHE |
Custom path for token cache | $HOME/.cache/drpcli/tokens |
|
-F, --format |
RS_FORMAT |
Output format: json, yaml, text, or table |
json |
-J, --print-fields |
RS_PRINT_FIELDS |
Comma-separated list of fields for text/table output |
all fields |
-H, --no-header |
RS_NO_HEADER |
Hide column headers in text/table output |
false |
-j, --truncate-length |
RS_TRUNCATE_LENGTH |
Maximum column width in text/table output |
40 |
-N, --no-color |
RS_NO_COLOR |
Disable colorized output | false |
-C, --colors |
RS_COLORS |
Custom color configuration string | |
-t, --trace |
Server-side log level for API requests | ||
-Z, --trace-token |
Token for identifying traced requests in server logs | ||
RS_OBJECT_ERRORS_ARE_FATAL |
Exit with non-zero status if returned object has errors | false |
|
RS_SHOW_GLOBAL_HELP_FLAGS |
Show global flags in help output | false |
|
RS_PROFILE |
Current active profile name (managed by drpcli config) |
Note
If RS_DOWNLOAD_PROXY is not set, drpcli will check for standard proxy environment variables in this order: https_proxy, HTTPS_PROXY, http_proxy, HTTP_PROXY.
Authentication Methods¶
Client Certificates (Mutual TLS)¶
Requires both RS_CLIENT_CERT and RS_CLIENT_KEY to be set.
RS_CLIENT_CERT=/path/to/client.crt
RS_CLIENT_KEY=/path/to/client.key
RS_CA_CERT=/path/to/ca.crt
RS_SERVER_VERIFY=true
Token Authentication¶
Use a pre-generated token. Tokens can have limited scope and expiration. See Granting a User Token for details on creating tokens.
Username and Password¶
Basic authentication with username and password.
Note
By default, drpcli caches authentication tokens in $HOME/.cache/drpcli/tokens/ to avoid re-authenticating on every command. Use --no-token to disable this behavior.
See Also¶
- Using the
.drpclircFile — Detailed.drpclircreference - drpcli Usage — General drpcli usage
- Granting a User Token — Creating user tokens
- JQ Usage Examples — Using jq with drpcli output