feat(config): add yaml config with generic env override #1

Open
master wants to merge 6 commits from feat/yaml-config into main
3 changed files with 10 additions and 10 deletions
Showing only changes of commit f3dedf47f3 - Show all commits

View File

@@ -41,6 +41,12 @@ make test
make lint
```
## Configuration
The application is configured via a YAML file (default `config/config.yaml`) and environment variables.
For detailed documentation on configuration options and logging, see [docs/configuration.md](docs/configuration.md).
## Docker
Build the Docker image:

View File

@@ -28,9 +28,7 @@ func main() {
}
// Setup Logger
logging.Configure(logging.Config{
Level: cfg.Logging.Level,
})
logging.Configure(cfg.Logging)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

View File

@@ -8,20 +8,16 @@ import (
"strings"
"time"
"github.com/placeholder/golang-template/internal/logging"
"gopkg.in/yaml.v3"
)
// Config holds the application configuration.
type Config struct {
Logging LoggingConfig `yaml:"logging"`
Logging logging.Config `yaml:"logging"`
Server ServerConfig `yaml:"server"`
}
// LoggingConfig holds logging-specific configuration.
type LoggingConfig struct {
Level string `yaml:"level"`
}
// ServerConfig holds server-specific configuration.
type ServerConfig struct {
Host string `yaml:"host"`