switch all other services to struct tag based env config
This commit is contained in:
committed by
Jörn Friedrich Dreyer
parent
288d6c469e
commit
6990e7d660
@@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
if err := command.Execute(config.New()); err != nil {
|
||||
if err := command.Execute(config.DefaultConfig()); err != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,10 +26,12 @@ func Execute(cfg *config.Config) error {
|
||||
Email: "support@owncloud.com",
|
||||
},
|
||||
},
|
||||
|
||||
Before: func(c *cli.Context) error {
|
||||
cfg.Service.Version = version.String
|
||||
return nil
|
||||
return ParseConfig(c, cfg)
|
||||
},
|
||||
|
||||
Commands: []*cli.Command{
|
||||
Server(cfg),
|
||||
Health(cfg),
|
||||
@@ -89,7 +91,7 @@ type SutureService struct {
|
||||
|
||||
// NewSutureService creates a new glauth.SutureService
|
||||
func NewSutureService(cfg *ociscfg.Config) suture.Service {
|
||||
cfg.GLAuth.Commons = cfg.Commons
|
||||
//cfg.GLAuth.Commons = cfg.Commons
|
||||
return SutureService{
|
||||
cfg: cfg.GLAuth,
|
||||
}
|
||||
|
||||
+13
-14
@@ -84,25 +84,24 @@ type FallbackBackend struct {
|
||||
type Config struct {
|
||||
*shared.Commons
|
||||
|
||||
Log Log `ocisConfig:"log"`
|
||||
Debug Debug `ocisConfig:"debug"`
|
||||
Service Service `ocisConfig:"service"`
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Ldap Ldap `ocisConfig:"ldap"`
|
||||
Ldaps Ldaps `ocisConfig:"ldaps"`
|
||||
Backend Backend `ocisConfig:"backend"`
|
||||
Fallback FallbackBackend `ocisConfig:"fallback"`
|
||||
RoleBundleUUID string `ocisConfig:"role_bundle_uuid" env:"GLAUTH_ROLE_BUNDLE_ID"`
|
||||
Service Service `ocisConfig:"service"`
|
||||
|
||||
Tracing Tracing `ocisConfig:"tracing"`
|
||||
Log Log `ocisConfig:"log"`
|
||||
Debug Debug `ocisConfig:"debug"`
|
||||
|
||||
Ldap Ldap `ocisConfig:"ldap"`
|
||||
Ldaps Ldaps `ocisConfig:"ldaps"`
|
||||
|
||||
Backend Backend `ocisConfig:"backend"`
|
||||
Fallback FallbackBackend `ocisConfig:"fallback"`
|
||||
|
||||
RoleBundleUUID string `ocisConfig:"role_bundle_uuid" env:"GLAUTH_ROLE_BUNDLE_ID"`
|
||||
|
||||
Context context.Context
|
||||
Supervised bool
|
||||
}
|
||||
|
||||
// New initializes a new configuration with or without defaults.
|
||||
func New() *Config {
|
||||
return &Config{}
|
||||
}
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
Debug: Debug{
|
||||
|
||||
Reference in New Issue
Block a user