Skip to main content

Environment Variables

The Tenderly CLI uses configuration files for most settings, but you can also customize behavior through command-line flags and environment-specific configurations.

Configuration Files

The CLI uses two main configuration files:
Location: ~/.tenderly/config.yaml (or ~/.tenderly/config.json)Purpose: Stores user authentication and global settingsContents:
  • Access tokens and authentication keys
  • Account ID
  • Username or organization name
  • Email (for user accounts)
Customization: You can change the global config file name using the --global-config flag:
tenderly --global-config my-config [command]
This will look for ~/.tenderly/my-config.yaml instead of config.yaml.
Location: ./tenderly.yaml (in your project directory)Purpose: Stores project-specific settingsContents:
  • Project slug
  • Account ID
  • Provider (deployment framework)
  • Compiler configuration
  • Network settings
  • Actions configuration
  • Node extensions configuration
Customization: You can change the project config file name using the --project-config flag:
tenderly --project-config my-project [command]
This will look for my-project.yaml instead of tenderly.yaml.

Configuration Flags

While the Tenderly CLI doesn’t use traditional environment variables, you can configure it using global flags:

Global Flags

--global-config
string
default:"config"
Specify a custom global configuration file name (without extension)Example:
tenderly --global-config staging login
tenderly --global-config staging whoami
This allows you to maintain separate configurations for different environments.
--project-config
string
default:"tenderly"
Specify a custom project configuration file name (without extension)Example:
tenderly --project-config tenderly-dev init
tenderly --project-config tenderly-prod contracts push
This allows you to maintain separate project configurations for different environments.
--project-dir
string
default:"."
Specify the project directory containing your smart contractsExample:
tenderly --project-dir ./my-contracts init
tenderly --project-dir ./path/to/project contracts push
--output
string
default:"text"
Set the output format: text or jsonExample:
tenderly --output json whoami
tenderly --output json contracts push
JSON output is useful for scripting and automation.
--debug
boolean
default:"false"
Enable debug logging for troubleshootingExample:
tenderly --debug contracts push
tenderly --debug actions deploy
Debug mode provides detailed logging including:
  • API request/response details
  • File system operations
  • Internal processing steps
--reset-provider
boolean
default:"false"
Clear the set deployment provider and auto-detectExample:
tenderly --reset-provider init
Useful when switching between different smart contract frameworks (Truffle, Hardhat, etc.)

Multi-Environment Setup

You can manage multiple environments using different configuration files:

Separate Global Configs

Maintain separate authentication for different accounts:
# Login with development account
tenderly --global-config dev login

# Use development account
tenderly --global-config dev whoami
tenderly --global-config dev contracts push
This creates separate config files:
  • ~/.tenderly/dev.yaml
  • ~/.tenderly/prod.yaml

Separate Project Configs

Maintain different project settings:
project_slug: my-project-dev
account_id: dev-account
provider: hardhat
networks:
  - 5  # Goerli testnet
Use them with:
# Development
tenderly --project-config tenderly-dev contracts push

# Production
tenderly --project-config tenderly-prod contracts push

CI/CD Integration

For continuous integration and deployment pipelines, use these patterns:

Authenticate with Access Key

- name: Login to Tenderly
  run: |
    tenderly login \
      --authentication-method access-key \
      --access-key ${{ secrets.TENDERLY_ACCESS_KEY }}

- name: Push contracts
  run: tenderly contracts push

JSON Output for Parsing

Use JSON output mode for programmatic access:
# Get user info as JSON
tenderly --output json whoami

# Parse with jq
USER_ID=$(tenderly --output json whoami | jq -r '.id')

Non-Interactive Mode

Provide all parameters via flags to avoid prompts:
# Initialize without prompts
tenderly init \
  --project my-project \
  --force

# Login without prompts
tenderly login \
  --authentication-method access-key \
  --access-key $ACCESS_KEY \
  --force

Configuration File Locations

Default Location: ~/.tenderly/Files:
  • config.yaml (or config.json) - Main config file
  • Custom configs when using --global-config flag
Permissions: These files contain sensitive authentication tokens. Ensure they have appropriate file permissions:
chmod 600 ~/.tenderly/config.yaml
Default Location: Project root directoryFiles:
  • tenderly.yaml (or tenderly.json) - Main project config
  • Custom configs when using --project-config flag
Version Control: The project config file should be committed to version control, but be careful not to include sensitive data. The global config with authentication tokens should NOT be committed.

Best Practices

Secure Credentials

Never commit authentication tokens or access keys to version control. Use:
  • Separate global configs for different accounts
  • CI/CD secret management for automation
  • Access keys instead of email/password for automated workflows

Environment Separation

Use different project configs for different environments:
  • tenderly-dev.yaml for development
  • tenderly-staging.yaml for staging
  • tenderly-prod.yaml for production

Automation

For CI/CD pipelines:
  • Use --output json for programmatic parsing
  • Provide all flags to avoid interactive prompts
  • Use access keys for authentication
  • Enable --debug when troubleshooting

Multi-Account Management

Manage multiple Tenderly accounts:
  • Use --global-config to switch between accounts
  • Keep separate configs for personal, team, and client accounts
  • Document which config corresponds to which account

Build docs developers (and LLMs) love