refactor(config): decouple logging config and update readme
Refactors internal/config to use logging.Config directly, removing duplication. Updates README.md to reference configuration documentation.
This commit is contained in:
@@ -41,6 +41,12 @@ make test
|
|||||||
make lint
|
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
|
## Docker
|
||||||
|
|
||||||
Build the Docker image:
|
Build the Docker image:
|
||||||
|
|||||||
@@ -28,9 +28,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Setup Logger
|
// Setup Logger
|
||||||
logging.Configure(logging.Config{
|
logging.Configure(cfg.Logging)
|
||||||
Level: cfg.Logging.Level,
|
|
||||||
})
|
|
||||||
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|||||||
@@ -8,18 +8,14 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/placeholder/golang-template/internal/logging"
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Config holds the application configuration.
|
// Config holds the application configuration.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Logging LoggingConfig `yaml:"logging"`
|
Logging logging.Config `yaml:"logging"`
|
||||||
Server ServerConfig `yaml:"server"`
|
Server ServerConfig `yaml:"server"`
|
||||||
}
|
|
||||||
|
|
||||||
// LoggingConfig holds logging-specific configuration.
|
|
||||||
type LoggingConfig struct {
|
|
||||||
Level string `yaml:"level"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ServerConfig holds server-specific configuration.
|
// ServerConfig holds server-specific configuration.
|
||||||
|
|||||||
Reference in New Issue
Block a user