Environment Variables
Botmarley can be configured using environment variables, which take precedence over settings file values.
Core Variables
| Variable | Default | Description |
|---|---|---|
DATABASE_URL | From settings.toml | PostgreSQL connection string |
HOST | 127.0.0.1 | Server bind address |
PORT | 3000 | Server listen port |
BOTMARLEY_HOME | ~/.botmarley | Configuration and data directory |
RUST_LOG | info | Controls log verbosity (trace, debug, info, warn, error) |
Database URL Format
postgresql://username:password@host:port/database
Examples:
# Local development
DATABASE_URL=postgresql://botmarley:botmarley_dev@localhost:5432/botmarley
# Production
DATABASE_URL=postgresql://botmarley_prod:secure-password@127.0.0.1:5432/botmarley_prod
Setting Variables
In systemd
Add Environment= lines to your service file:
[Service]
Environment=DATABASE_URL=postgresql://user:pass@localhost:5432/db
Environment=HOST=0.0.0.0
Environment=PORT=3000
In Shell
export DATABASE_URL=postgresql://botmarley:botmarley_dev@localhost:5432/botmarley
export PORT=3000
./server
In Docker
docker run -e DATABASE_URL=postgresql://... -e PORT=3000 botmarley
Precedence
Environment variables override values from settings.toml:
Environment Variable > settings.toml > Default Value
Use environment variables for deployment-specific settings (database URLs, ports) and the settings file for application preferences (Telegram config, data paths).
Multi-Instance Deployment
To run multiple Botmarley instances on the same server, use different ports and databases:
# Instance 1
PORT=3000 DATABASE_URL=postgresql://...db1 ./server
# Instance 2
PORT=3001 DATABASE_URL=postgresql://...db2 ./server
Each instance operates independently with its own database, accounts, and trading sessions.