hook accounts to env variables

This commit is contained in:
A.Unger
2021-11-04 13:16:16 +01:00
parent e858fa0188
commit b61887aca1
5 changed files with 221 additions and 255 deletions
+9 -2
View File
@@ -66,13 +66,20 @@ func NewLogger(cfg *config.Config) log.Logger {
)
}
// ParseConfig loads accounts configuration from known paths.
// ParseConfig loads proxy configuration from known paths.
func ParseConfig(c *cli.Context, cfg *config.Config) error {
_, err := ociscfg.BindSourcesToStructs("accounts", cfg)
conf, err := ociscfg.BindSourcesToStructs("accounts", cfg)
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
}
-2
View File
@@ -8,7 +8,6 @@ import (
"github.com/oklog/run"
"github.com/owncloud/ocis/accounts/pkg/config"
"github.com/owncloud/ocis/accounts/pkg/flagset"
"github.com/owncloud/ocis/accounts/pkg/metrics"
"github.com/owncloud/ocis/accounts/pkg/server/grpc"
"github.com/owncloud/ocis/accounts/pkg/server/http"
@@ -23,7 +22,6 @@ func Server(cfg *config.Config) *cli.Command {
Name: "server",
Usage: "Start ocis accounts service",
Description: "uses an LDAP server as the storage backend",
Flags: flagset.ServerWithConfig(cfg),
Before: func(ctx *cli.Context) error {
logger := NewLogger(cfg)
if cfg.HTTP.Root != "/" {