normalize web
This commit is contained in:
+3
-22
@@ -62,14 +62,9 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error {
|
||||
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 web command to be embedded and supervised by a suture supervisor tree.
|
||||
@@ -79,11 +74,7 @@ type SutureService struct {
|
||||
|
||||
// NewSutureService creates a new web.SutureService
|
||||
func NewSutureService(cfg *ociscfg.Config) suture.Service {
|
||||
inheritLogging(cfg)
|
||||
if cfg.Mode == 0 {
|
||||
cfg.Web.Supervised = true
|
||||
}
|
||||
cfg.Web.Log.File = cfg.Log.File
|
||||
cfg.Web.Log = cfg.Log
|
||||
return SutureService{
|
||||
cfg: cfg.Web,
|
||||
}
|
||||
@@ -97,13 +88,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.Web.Log.File = cfg.Log.File
|
||||
cfg.Web.Log.Color = cfg.Log.Color
|
||||
cfg.Web.Log.Pretty = cfg.Log.Pretty
|
||||
cfg.Web.Log.Level = cfg.Log.Level
|
||||
}
|
||||
|
||||
@@ -30,9 +30,6 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
return err
|
||||
}
|
||||
|
||||
logger := NewLogger(cfg)
|
||||
logger.Debug().Str("service", "web").Msg("ignoring config file parsing when running supervised")
|
||||
|
||||
// build well known openid-configuration endpoint if it is not set
|
||||
if cfg.Web.Config.OpenIDConnect.MetadataURL == "" {
|
||||
cfg.Web.Config.OpenIDConnect.MetadataURL = strings.TrimRight(cfg.Web.Config.OpenIDConnect.Authority, "/") + "/.well-known/openid-configuration"
|
||||
|
||||
Reference in New Issue
Block a user