mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-04-21 18:28:27 -05:00
normalize thumbnails
This commit is contained in:
@@ -70,15 +70,9 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// load all env variables relevant to the config in the current context.
|
||||
conf.LoadOSEnv(config.GetEnv(), false)
|
||||
|
||||
if err = cfg.UnmapEnv(conf); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
bindings := config.StructMappings(cfg)
|
||||
return ociscfg.BindEnv(conf, bindings)
|
||||
}
|
||||
|
||||
// SutureService allows for the thumbnails command to be embedded and supervised by a suture supervisor tree.
|
||||
@@ -88,11 +82,7 @@ type SutureService struct {
|
||||
|
||||
// NewSutureService creates a new thumbnails.SutureService
|
||||
func NewSutureService(cfg *ociscfg.Config) suture.Service {
|
||||
inheritLogging(cfg)
|
||||
if cfg.Mode == 0 {
|
||||
cfg.Thumbnails.Supervised = true
|
||||
}
|
||||
cfg.Thumbnails.Log.File = cfg.Log.File
|
||||
cfg.Thumbnails.Log = cfg.Log
|
||||
return SutureService{
|
||||
cfg: cfg.Thumbnails,
|
||||
}
|
||||
@@ -106,13 +96,3 @@ func (s SutureService) Serve(ctx context.Context) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// inheritLogging is a poor man's global logging state tip-toeing around circular dependencies. It sets the logging
|
||||
// of the service to whatever is in the higher config (in this case coming from ocis.yaml) and sets them as defaults,
|
||||
// being overwritten when the extension parses its config file / env variables.
|
||||
func inheritLogging(cfg *ociscfg.Config) {
|
||||
cfg.Thumbnails.Log.File = cfg.Log.File
|
||||
cfg.Thumbnails.Log.Color = cfg.Log.Color
|
||||
cfg.Thumbnails.Log.Pretty = cfg.Log.Pretty
|
||||
cfg.Thumbnails.Log.Level = cfg.Log.Level
|
||||
}
|
||||
|
||||
@@ -20,13 +20,7 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
Name: "server",
|
||||
Usage: "Start integrated server",
|
||||
Before: func(ctx *cli.Context) error {
|
||||
if err := ParseConfig(ctx, cfg); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
logger := NewLogger(cfg)
|
||||
logger.Debug().Str("service", "thumbnails").Msg("ignoring config file parsing when running supervised")
|
||||
return nil
|
||||
return ParseConfig(ctx, cfg)
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logger := NewLogger(cfg)
|
||||
|
||||
Reference in New Issue
Block a user