Back to HomeTurboCI Docs

Environment Variables

TurboCI uses environment variables to authenticate with cloud providers. Each provider requires its own API key.

How It Works

When you specify a provider in your config.yaml file, TurboCI automatically looks for the corresponding environment variable. No manual connection or setup required.

# In config.yaml
provider: hetzner

# TurboCI automatically looks for:
# TURBOCI_HETZNER_API_KEY

Supported Providers

Hetzner

TURBOCI_HETZNER_API_KEY=your_api_key_here

AWS

TURBOCI_AWS_API_KEY=your_api_key_here

Google Cloud Platform

TURBOCI_GCP_API_KEY=your_api_key_here

Azure

TURBOCI_AZURE_API_KEY=your_api_key_here

Setting Environment Variables

Option 1: .env File (Recommended)

Create a .env file in your working directory with your API keys:

# .env
TURBOCI_HETZNER_API_KEY=hetzner_key_here
TURBOCI_AWS_API_KEY=aws_key_here
TURBOCI_GCP_API_KEY=gcp_key_here

TurboCI automatically loads variables from .env files in the current directory.

Option 2: System Environment

Add variables to your system environment for global access:

# Linux / macOS
export TURBOCI_HETZNER_API_KEY=your_api_key_here

# Windows (PowerShell)
$env:TURBOCI_HETZNER_API_KEY="your_api_key_here"

# Windows (CMD)
set TURBOCI_HETZNER_API_KEY=your_api_key_here

Option 3: Inline

Set variables inline for a single command:

TURBOCI_HETZNER_API_KEY=your_key turboci up

Multi-Cloud Example

When deploying to multiple clouds, TurboCI automatically uses the correct API key for each provider:

# .env
TURBOCI_HETZNER_API_KEY=hetzner_key
TURBOCI_AWS_API_KEY=aws_key

# config.yaml
deployments:
  - deployment_name: web_hetzner
    provider: hetzner  # Uses TURBOCI_HETZNER_API_KEY
    services: [...]
    
  - deployment_name: web_aws
    provider: aws      # Uses TURBOCI_AWS_API_KEY
    services: [...]

Security Note

Never commit .env files to version control. Add .env to your .gitignore file:

# .gitignore\n.env

Next Steps

Learn about TurboCI's safe update strategy with built-in canary deployments.

Continue to Update Strategy →