Skip to content

Configuration Reference

This document provides a comprehensive reference for all configuration options available in Trailer.dev.

Configuration Methods

Trailer.dev can be configured through:

  • Environment variables
  • Configuration file (YAML)
  • Command line flags

Configuration Categories

Server Configuration

  • Server URL and port
  • Host settings
  • Authentication settings
  • Security options

Agent Configuration

  • Agent type (Docker/Kubernetes)
  • Build directory settings
  • Deployment name
  • Hostname configuration
  • Authentication token
  • Build context management

Dynamic Configuration

  • Host enablement
  • Heartbeat intervals
  • Reconciliation intervals

Configuration File Structure

The configuration file (config.yaml) supports the following structure:

yaml
server:
  url: "http://localhost:8090"
  port: 8090
  host: "0.0.0.0"

agent:
  type: "docker"  # or "kubernetes"
  deployment_name: "default"
  host_name: "host-1"
  build_directory: "/tmp"
  delete_build_context_after_build: true

dynamic:
  host_enabled: true
  heartbeat_interval: "30s"
  reconciliation_interval: "1m"

Environment Variables

Common environment variables:

bash
# Server settings
TRAILER_SERVER_URL=http://localhost:8090
TRAILER_SERVER_PORT=8090
TRAILER_SERVER_HOST=0.0.0.0

# Agent settings
TRAILER_AGENT_TYPE=docker
TRAILER_AGENT_DEPLOYMENT_NAME=default
TRAILER_AGENT_HOST_NAME=host-1
TRAILER_AGENT_BUILD_DIR=/tmp
TRAILER_AGENT_DELETE_BUILD_CONTEXT=true

# Dynamic settings
TRAILER_HOST_ENABLED=true
TRAILER_HEARTBEAT_INTERVAL=30s
TRAILER_RECONCILIATION_INTERVAL=1m

Command Line Flags

Common command line flags:

bash
trailer --server-url http://localhost:8090 \
        --port 8090 \
        --host 0.0.0.0 \
        --agent-type docker \
        --deployment-name default \
        --host-name host-1 \
        --build-dir /tmp \
        --delete-build-context \
        --host-enabled \
        --heartbeat-interval 30s \
        --reconciliation-interval 1m

Configuration Precedence

Configuration options are applied in the following order (later options override earlier ones):

  1. Default values
  2. Configuration file
  3. Environment variables
  4. Command line flags

Security Considerations

  • Sensitive values like authentication tokens should be provided through environment variables or secure secret management
  • Configuration files should have appropriate permissions (readable only by the application user)
  • Avoid storing sensitive information in version control

Best Practices

  1. Configuration File Location

    • Default: ~/.config/trailer/config.yaml
    • Can be overridden with --config flag
  2. Environment Variables

    • Use for sensitive information
    • Use for environment-specific settings
    • Follow the TRAILER_* prefix convention
  3. Command Line Flags

    • Use for temporary overrides
    • Use for development/testing
    • Use for one-off configurations
  4. Configuration Validation

    • All configuration options are validated at startup
    • Invalid configurations will prevent the application from starting
    • Check logs for configuration errors

Released under the MIT License.