Configuration¶
Everything is set through environment variables, or a .env file in development. DATABASE_URL, HOST and PORT must be in the environment itself: layout.toml reads them there, to start the app's process.
| Variable | Default | Meaning |
|---|---|---|
DATABASE_URL |
(required) | Database URL: postgresql://user:password@host/db in production. The app refuses to start without it. The Makefile's run, db-upgrade and seed-db targets set sqlite:///data/db.sqlite3 when it isn't set. |
HOST, PORT |
127.0.0.1, 5000 |
Where the app listens (layout.toml). Hop3 sets PORT, and hop3.toml sets HOST to 0.0.0.0; make run listens on 0.0.0.0. |
SECRET_KEY |
(placeholder) | Signs and encrypts login cookies. At least 32 random characters; the app refuses to start with the placeholder unless DEBUG is on. |
DEBUG |
false |
Development mode. Never in production: it also allows non-HTTPS cookies. |
PUBLIC_URL |
(none) | The app's address as its users reach it, such as https://stats.example.com. Alerts link to the report with it; without it, they have no link. |
SMTP_HOST |
(none) | The SMTP server the app sends mail through: alerts and email reports. Without it, the app sends no mail and offers none. Hop3's email addon sets it. |
SMTP_PORT |
25 |
Its port. The app doesn't authenticate: point it at a local relay, which holds the provider's credentials. |
SMTP_FROM |
(none) | The sender's address, on a domain with SPF, DKIM and DMARC records. Hop3's email addon sets it. |
GEOIP_DIR |
data/geoip |
Where the country and network databases are kept (country.mmdb, asn.mmdb). |
VISIT_TIMEOUT_MINUTES |
30 |
A visit ends after this much inactivity. |
EXCLUDED_RETENTION_DAYS |
30 |
Visits left out of the reports (bots, datacenters…) are deleted after this many days. |
AUTH_SESSION_TIMEOUT |
86400 |
Login session lifetime, in seconds. |
AUTH_COOKIE_NAME |
aa_session |
The login cookie's name. |
On Hop3, the PostgreSQL addon sets DATABASE_URL and hop3.toml generates SECRET_KEY: nothing needs to be set by hand.