Skip to content

Configuration

Rainlogs uses Viper for configuration management. It supports reading from environment variables, configuration files (e.g., config.yaml), and command-line flags.

Environment Variables

The primary way to configure Rainlogs is through environment variables. The application expects variables to be prefixed with RAINLOGS_.

Core Settings

VariableDescriptionDefault
RAINLOGS_ENVThe environment (e.g., development, production).development
RAINLOGS_PORTThe port the API listens on.8080
RAINLOGS_LOG_LEVELThe logging level (e.g., debug, info, warn, error).info

Database

VariableDescriptionDefault
RAINLOGS_DB_HOSTThe PostgreSQL host.localhost
RAINLOGS_DB_PORTThe PostgreSQL port.5432
RAINLOGS_DB_USERThe PostgreSQL user.postgres
RAINLOGS_DB_PASSWORDThe PostgreSQL password.postgres
RAINLOGS_DB_NAMEThe PostgreSQL database name.rainlogs

Redis

VariableDescriptionDefault
RAINLOGS_REDIS_HOSTThe Redis host.localhost
RAINLOGS_REDIS_PORTThe Redis port.6379
RAINLOGS_REDIS_PASSWORDThe Redis password.""

Storage (Garage S3)

VariableDescriptionDefault
RAINLOGS_STORAGE_ENDPOINTThe S3 endpoint URL.http://localhost:3900
RAINLOGS_STORAGE_REGIONThe S3 region.us-east-1
RAINLOGS_STORAGE_BUCKETThe S3 bucket name.rainlogs-logs
RAINLOGS_STORAGE_ACCESS_KEYThe S3 access key ID.""
RAINLOGS_STORAGE_SECRET_KEYThe S3 secret access key.""

Security

VariableDescriptionDefault
RAINLOGS_KMS_KEYThe 32-byte base64-encoded KMS key used for encryption.""

Cloudflare

VariableDescriptionDefault
RAINLOGS_CLOUDFLARE_RATE_LIMITThe rate limit for Cloudflare API requests (requests per second).0 (unlimited)
RAINLOGS_CLOUDFLARE_MAX_WINDOW_SIZEMax log pull window per request.1h

Configuration File

You can also provide a config.yaml file in the root directory of the application. The structure mirrors the environment variables.

yaml
env: development
port: 8080
log_level: info

db:
  host: localhost
  port: 5432
  user: postgres
  password: password
  name: rainlogs

redis:
  host: localhost
  port: 6379
  password: ""

storage:
  endpoint: http://localhost:3900
  region: us-east-1
  bucket: rainlogs-logs
  access_key: your-access-key
  secret_key: your-secret-key

kms:
  key: your-base64-encoded-key

Zero-Config Initialization

If the RAINLOGS_STORAGE_ACCESS_KEY and RAINLOGS_STORAGE_SECRET_KEY are not provided, Rainlogs will attempt to automatically generate them by connecting to the Garage S3 instance and creating the necessary buckets. This is the recommended approach for local development and testing.

Released under the Apache 2.0 License.