addded web to the new inheritance strategy
This commit is contained in:
@@ -88,13 +88,15 @@ type Web struct {
|
||||
|
||||
// Config combines all available configuration parts.
|
||||
type Config struct {
|
||||
File string `mapstructure:"file"`
|
||||
Log shared.Log `mapstructure:"log"`
|
||||
Debug Debug `mapstructure:"debug"`
|
||||
HTTP HTTP `mapstructure:"http"`
|
||||
Tracing Tracing `mapstructure:"tracing"`
|
||||
Asset Asset `mapstructure:"asset"`
|
||||
Web Web `mapstructure:"web"`
|
||||
*shared.Commons
|
||||
|
||||
File string `mapstructure:"file"`
|
||||
Log *shared.Log `mapstructure:"log"`
|
||||
Debug Debug `mapstructure:"debug"`
|
||||
HTTP HTTP `mapstructure:"http"`
|
||||
Tracing Tracing `mapstructure:"tracing"`
|
||||
Asset Asset `mapstructure:"asset"`
|
||||
Web Web `mapstructure:"web"`
|
||||
|
||||
Context context.Context
|
||||
Supervised bool
|
||||
@@ -107,7 +109,6 @@ func New() *Config {
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
Log: shared.Log{},
|
||||
Debug: Debug{
|
||||
Addr: "127.0.0.1:9104",
|
||||
Token: "",
|
||||
@@ -150,14 +151,3 @@ func DefaultConfig() *Config {
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// GetEnv fetches a list of known env variables for this extension. It is to be used by gookit, as it provides a list
|
||||
// with all the environment variables an extension supports.
|
||||
func GetEnv() []string {
|
||||
var r = make([]string, len(structMappings(&Config{})))
|
||||
for i := range structMappings(&Config{}) {
|
||||
r = append(r, structMappings(&Config{})[i].EnvVars...)
|
||||
}
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
@@ -2,6 +2,17 @@ package config
|
||||
|
||||
import "github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
|
||||
// GetEnv fetches a list of known env variables for this extension. It is to be used by gookit, as it provides a list
|
||||
// with all the environment variables an extension supports.
|
||||
func GetEnv(cfg *Config) []string {
|
||||
var r = make([]string, len(structMappings(cfg)))
|
||||
for i := range structMappings(cfg) {
|
||||
r = append(r, structMappings(cfg)[i].EnvVars...)
|
||||
}
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
// StructMappings binds a set of environment variables to a destination on cfg. Iterating over this set and editing the
|
||||
// Destination value of a binding will alter the original value, as it is a pointer to its memory address. This lets
|
||||
// us propagate changes easier.
|
||||
|
||||
Reference in New Issue
Block a user