updates go dependencies, refactors config loading precedence, adds gRPC gateway path stripping option, and improves HTTP handler setup.
This commit is contained in:
@@ -50,6 +50,10 @@ func LoadConfig(ctx context.Context) (context.Context, error) {
|
||||
func loadConfig(configPath string) (*AppConfig, error) {
|
||||
cfg := *DefaultConfig
|
||||
|
||||
if err := env.ParseWithOptions(&cfg, env.Options{DefaultValueTagName: "default"}); err != nil {
|
||||
return nil, fmt.Errorf("could not parse environment variables: %w", err)
|
||||
}
|
||||
|
||||
if configPath != "" {
|
||||
file, err := os.Open(configPath)
|
||||
if err != nil {
|
||||
@@ -63,10 +67,6 @@ func loadConfig(configPath string) (*AppConfig, error) {
|
||||
}
|
||||
}
|
||||
|
||||
if err := env.ParseWithOptions(&cfg, env.Options{DefaultValueTagName: "default"}); err != nil {
|
||||
return nil, fmt.Errorf("could not parse environment variables: %w", err)
|
||||
}
|
||||
|
||||
// Perform updates / enrichments
|
||||
err := prepareConfig(&cfg)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user