fuego.yaml, environment variables, and programmatic options.
Configuration Priority
Configuration values are resolved in this order (highest to lowest priority):- Programmatic options -
fuego.New(WithPort("8080")) - Environment variables -
FUEGO_PORT=8080 - fuego.yaml file -
port: 8080 - Default values -
3000
fuego.yaml Reference
Createfuego.yaml in your project root:
Configuration Options
Server Configuration
port
port
The port the server listens on.
| Property | Value |
|---|---|
| Type | string |
| Default | "3000" |
| Env | FUEGO_PORT |
host
host
The host address to bind to.
| Property | Value |
|---|---|
| Type | string |
| Default | "0.0.0.0" |
| Env | FUEGO_HOST |
Directory Configuration
app_dir
app_dir
The directory containing your route files.
| Property | Value |
|---|---|
| Type | string |
| Default | "app" |
| Env | FUEGO_APP_DIR |
static_dir
static_dir
The directory containing static files to serve.
| Property | Value |
|---|---|
| Type | string |
| Default | "static" |
| Env | FUEGO_STATIC_DIR |
static_path
static_path
The URL path prefix for static files.
This means files in
| Property | Value |
|---|---|
| Type | string |
| Default | "/static" |
| Env | FUEGO_STATIC_PATH |
static/css/style.css would be served at /assets/css/style.css.Development Configuration
dev.hot_reload
dev.hot_reload
Enable hot reloading during development.
| Property | Value |
|---|---|
| Type | bool |
| Default | true |
| Env | FUEGO_HOT_RELOAD |
dev.watch_extensions
dev.watch_extensions
File extensions to watch for changes.
| Property | Value |
|---|---|
| Type | []string |
| Default | [".go", ".templ"] |
dev.exclude_dirs
dev.exclude_dirs
Directories to exclude from file watching.
| Property | Value |
|---|---|
| Type | []string |
| Default | ["node_modules", ".git", "_*"] |
Middleware Configuration
middleware.logger
middleware.logger
Enable the built-in request logger.
| Property | Value |
|---|---|
| Type | bool |
| Default | true |
| Env | FUEGO_LOGGER |
middleware.recover
middleware.recover
Enable panic recovery middleware.
| Property | Value |
|---|---|
| Type | bool |
| Default | true |
| Env | FUEGO_RECOVER |
Environment Variables
All configuration options can be set via environment variables with theFUEGO_ prefix:
| Variable | Description | Default |
|---|---|---|
FUEGO_PORT | Server port | 3000 |
FUEGO_HOST | Server host | 0.0.0.0 |
FUEGO_APP_DIR | App directory | app |
FUEGO_STATIC_DIR | Static files directory | static |
FUEGO_STATIC_PATH | Static URL path | /static |
FUEGO_HOT_RELOAD | Enable hot reload | true |
FUEGO_LOGGER | Enable request logger | true |
FUEGO_RECOVER | Enable panic recovery | true |
FUEGO_LOG_LEVEL | Log level | info |
FUEGO_DEV | Development mode | false |
GO_ENV | Environment (affects logging) | - |
Log Level Configuration
Control logging verbosity withFUEGO_LOG_LEVEL:
Setting
FUEGO_DEV=true automatically sets log level to debug.
Setting GO_ENV=production automatically sets log level to warn.Programmatic Configuration
Configure your app in code using option functions:Available Options
Configuration Examples
Development Setup
Production Setup
Docker Configuration
Kubernetes ConfigMap
Accessing Configuration at Runtime
Access the current configuration from your app:Logger Configuration
Configure the request logger programmatically:Log Output Format
The logger produces output like:ShowIP and ShowUserAgent:
Validation
Fuego validates configuration at startup:- Port is not empty
- App directory is not empty
- App directory exists (if specified)
Best Practices
Use environment variables in production
Use environment variables in production
Don’t commit production secrets or configuration to git. Use environment variables for deployment-specific settings.
Keep fuego.yaml for development defaults
Keep fuego.yaml for development defaults
Use
fuego.yaml for sensible development defaults that all team members can share.Override per environment
Override per environment
Validate early
Validate early
Check configuration at startup rather than failing later: