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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user