Merged in bugfix/baseconfig (pull request #46)

Fix bug and add unit test to verify

* fix bug and test


* pr comments

* move to server

* fix tests
This commit is contained in:
Jay Brown
2025-02-05 20:03:36 +00:00
parent 056b848834
commit 0eea70067b
6 changed files with 151 additions and 85 deletions
+9
View File
@@ -8,6 +8,8 @@ import (
"github.com/go-playground/validator/v10"
)
const DEFAULT_SECRET_PREFIX = "secret"
type Config interface {
serviceconfig.ConfigProvider
SetValidator()
@@ -29,6 +31,13 @@ func (c *BaseConfig) GetValidator() *validator.Validate {
}
func New(ctx context.Context, cfg Config) (func() error, error) {
// init the config in case it has not already been called.
errInitializingConfig := serviceconfig.InitializeConfig(cfg)
if errInitializingConfig != nil {
return func() error { return nil }, errInitializingConfig
}
cfg.PrintConfig(DEFAULT_SECRET_PREFIX)
closeTracer := cfg.SetOtel(ctx)
err := migrations.Run(ctx, cfg)