refactor(config): centralize env loading and enforce typed access

- Centralize environment variable loading in config.MustLoad
- Parse and validate all env vars once at initialization
- Make config fields private and read-only
- Remove public Getenv usage in favor of typed accessors
- Improve validation and initialization order
- Normalize enum naming to be idiomatic and avoid constant collisions
This commit is contained in:
2026-01-21 19:43:19 +07:00
parent 1e12373359
commit 2bc20dd991
19 changed files with 414 additions and 257 deletions
+3 -3
View File
@@ -17,9 +17,9 @@ type RequestHeader interface {
Set(key string, value string)
Remove(key string)
Finalize() []byte
GetMethod() string
GetPath() string
GetVersion() string
Method() string
Path() string
Version() string
}
type requestHeader struct {
method string
+3 -3
View File
@@ -32,15 +32,15 @@ func (req *requestHeader) Remove(key string) {
delete(req.headers, key)
}
func (req *requestHeader) GetMethod() string {
func (req *requestHeader) Method() string {
return req.method
}
func (req *requestHeader) GetPath() string {
func (req *requestHeader) Path() string {
return req.path
}
func (req *requestHeader) GetVersion() string {
func (req *requestHeader) Version() string {
return req.version
}