Skip to content

Configuration keys ​

Every key Preá reads from config/application.yaml and the profile files. Your own keys can sit next to these and are read with value:"key".

Environment ​

VariableWhat it does
PREA_PROFILEthe active profile: loads config/application-<profile>.yaml on top of the base
any ${NAME}replaced by the variable's value where the YAML references it

.env in the working directory is read first and never overrides a variable that is already set. A value that is only ${NAME}, with NAME unset, counts as missing.

Server ​

KeyRequiredDefaultWhat it does
server.portyes—the port to listen on
server.modeyes—debug, release or test. debug indents the JSON and logs the routes
server.read_header_timeoutno5stime to read the request headers; protects against clients that send them very slowly
server.read_timeoutno30stime to read the whole request, body included
server.write_timeoutno30stime to write the reply; raise it for streaming and large downloads
server.idle_timeoutno120show long an idle keep-alive connection stays open
server.shutdown_timeoutno15show long the requests in flight get to finish on shutdown
server.max_header_bytesno1048576the largest request headers, in bytes (1 MB)
server.trusted_proxiesnononeproxies whose X-Forwarded-For is trusted. Security.TrustedProxies in code wins

Durations use Go's format: 500ms, 30s, 2m.

Logging ​

KeyDefaultValues
logging.levelinfodebug, info, success, warn, error
logging.formattexttext, json

preas.Logging in code wins over both.

Database ​

KeyDefaultWhat it does
database.urlnonethe PostgreSQL connection string. Without it, the app has no database
database.schemanonenone, validate, update, create or create-drop: what to do with the tables at startup (Models & schema)
database.migrations.dirmigrationsthe folder of the migration files
database.migrations.versionsemversemver (0.0.1) or timestamp (20261013120000)
database.migrations.on_startfalseapplies the pending migrations at startup
database.migrations.from_modelsfalsewrites a migration with the difference between the models and the database at startup

The connection pool is sized in the URL: ?pool_max_conns=20. The default is 4 or the number of CPUs, whichever is larger.

Security ​

KeyDefaultWhat it does
security.jwt.secretnonechecked at startup when set (at least 32 bytes). Pass the same value to security.NewJwt when the app signs tokens

In code ​

These live in preas/preas.go, not in the configuration:

VariableWhat it holds
Modulesthe preás of the app
Middlewaresthe middlewares of every request
SecurityCORS, CSRF, headers, trusted proxies and your own protections
Logginglog level and format, overriding the configuration

Released under the MIT License.