Config Struct
TheConfig struct holds all application configuration.
AppDir
AppDir
Type:
Default:
stringDefault:
"app"Directory containing route files, middleware, pages, and proxy.StaticDir
StaticDir
Type:
Default:Files are served at
stringDefault:
"static"Directory for static files (CSS, JS, images)./static/* by default.TemplateDir
TemplateDir
Type:
Default:
stringDefault:
""Directory for Go templates (if using html/template instead of templ).Port
Port
Type:
Default:
stringDefault:
"3000"Port to listen on. Can be overridden by PORT environment variable.Host
Host
Type:
Default:
stringDefault:
"0.0.0.0"Host to bind to.Dev
Dev
Type:
Default:Can be set via
boolDefault:
falseEnable development mode with debug logging.FUEGO_DEV=true environment variable.Options Pattern
Use option functions when creating an app:Available Options
| Option | Description |
|---|---|
WithAppDir(dir) | Set the app directory |
WithStaticDir(dir) | Set the static files directory |
WithTemplateDir(dir) | Set the template directory |
WithPort(port) | Set the server port |
WithHost(host) | Set the server host |
WithDev(enabled) | Enable/disable development mode |
fuego.yaml Configuration
Create afuego.yaml file in your project root for persistent configuration:
Configuration precedence (highest to lowest):
- Option functions passed to
fuego.New() - Environment variables
fuego.yamlfile- Default values
Environment Variables
| Variable | Description | Default |
|---|---|---|
PORT | Server port | 3000 |
HOST | Server host | 0.0.0.0 |
FUEGO_DEV | Development mode (true/false) | false |
FUEGO_LOG_LEVEL | Log level (debug, info, warn, error, off) | info |
GO_ENV | Environment (development, production, test) | - |
Log Level Behavior
GO_ENV | FUEGO_DEV | Default Log Level |
|---|---|---|
production | false | warn |
development | true | debug |
| - | - | info |
Request Logger Configuration
Configure the built-in request logger:RequestLoggerConfig Fields
Level
Level
Type:
Default:
LogLevelDefault:
LogLevelInfoMinimum log level for requests.| Level | Logs |
|---|---|
LogLevelDebug | All requests |
LogLevelInfo | All requests |
LogLevelWarn | 4xx and 5xx only |
LogLevelError | 5xx only |
LogLevelOff | Nothing |
ShowIP
ShowIP
Type:
Default:
boolDefault:
falseInclude client IP address in logs.ShowUserAgent
ShowUserAgent
Type:
Default:
boolDefault:
falseInclude User-Agent header in logs.SkipPaths
SkipPaths
Type:
Default:
[]stringDefault:
nilPaths to exclude from logging.SkipStatic
SkipStatic
Type:
Default:
boolDefault:
falseSkip logging for static file requests.Example Configurations
- Development
- Production
- Testing