Configuration
Overview
GoCamel supports multiple configuration strategies for credentials, endpoints, and component settings.
Credential Sources
gocamel.GetConfigValue(url, key) is the single entry point that every
component uses to resolve a configuration value. It checks four sources in
the following order — the first non-empty result wins:
- Exact-name environment variable. The key is used verbatim.
Example:
GetConfigValue(_, "OPENAI_API_KEY")readsos.Getenv("OPENAI_API_KEY"). - Scheme-prefixed environment variable. Built by uppercasing
scheme + "_" + key. For anftp://URI and keypassword, the lookup isos.Getenv("FTP_PASSWORD"). - URI query parameter. Example:
ftp://host?password=secret. - URI userinfo, for the well-known keys
username/userandpassword/passonly. Example:ftp://user:pass@host.
Environment Variables (Recommended)
Set sensitive data via environment variables:
Routes then reference the option directly — the env var is picked up automatically:
Query Parameters
Pass options as URI query parameters:
Credentials in URI queries are flagged at runtime
URI strings routinely leak into connection-error logs, audit trails,
crash reports and proxy access logs. When GetConfigValue resolves a
credential-like key (password, pass, secret, token, apikey,
api_key, accesskey, access_key, clientsecret, privatekey) from
a query parameter, it emits a WARN log recommending env vars. The
warning carries only the scheme and the key name — never the value — and
is deduped per (scheme, key) pairing so a polling consumer cannot flood
the logs.
Use environment variables in production. The userinfo form
(user:pass@host) is treated as the conventional URI way of carrying
credentials and is not warned about — you opted into it explicitly.
Direct in URI (userinfo form)
Context Configuration
Security
Never hardcode credentials:
Proxy
Component Registration
Standard Components
Scheduled Components
Messaging Components
AI Components
Database Components
Data Source Configuration
SQL Component
SQL-Stored Component
Route Configuration
Setting Route ID
Common Options
Environment Variable Mapping
| Component | Variable | Description |
|---|---|---|
| FTP | FTP_USERNAME, FTP_PASSWORD | FTP credentials |
| SFTP | SFTP_USERNAME, SFTP_PASSWORD, SFTP_PRIVATE_KEY_FILE | SSH credentials |
| Telegram | TELEGRAM_AUTHORIZATIONTOKEN | Bot token |
| OpenAI | OPENAI_AUTHORIZATIONTOKEN, OPENAI_API_KEY | API keys |
MAIL_USERNAME, MAIL_PASSWORD | Email credentials |
Best Practices
- Never commit secrets — Use env vars or secret managers
- Use different configs per environment — Dev/staging/prod
- Document required env vars — In README or deployment docs
- Validate config at startup — Fail fast on missing config