addded thumbnails to the new inheritance strategy

This commit is contained in:
A.Unger
2021-11-11 15:52:56 +01:00
parent 59f53390a8
commit 5f19300aaa
5 changed files with 37 additions and 52 deletions
+15 -4
View File
@@ -72,7 +72,20 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error {
if err != nil {
return err
}
conf.LoadOSEnv(config.GetEnv(), false)
// provide with defaults for shared logging, since we need a valid destination address for BindEnv.
if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
cfg.Log = &shared.Log{
Level: cfg.Commons.Log.Level,
Pretty: cfg.Commons.Log.Pretty,
Color: cfg.Commons.Log.Color,
File: cfg.Commons.Log.File,
}
} else if cfg.Log == nil && cfg.Commons == nil {
cfg.Log = &shared.Log{}
}
conf.LoadOSEnv(config.GetEnv(cfg), false)
bindings := config.StructMappings(cfg)
return ociscfg.BindEnv(conf, bindings)
}
@@ -84,9 +97,7 @@ type SutureService struct {
// NewSutureService creates a new thumbnails.SutureService
func NewSutureService(cfg *ociscfg.Config) suture.Service {
if (cfg.Thumbnails.Log == shared.Log{}) {
cfg.Thumbnails.Log = cfg.Log
}
cfg.Thumbnails.Commons = cfg.Commons
return SutureService{
cfg: cfg.Thumbnails,
}