sane common configurations

This commit is contained in:
A.Unger
2021-11-11 12:51:57 +01:00
parent 04d8ec86ab
commit aa67106e04
11 changed files with 72 additions and 97 deletions
+3 -4
View File
@@ -106,9 +106,9 @@ type Cache struct {
// Config combines all available configuration parts.
type Config struct {
OcisURL string
*shared.Commons
Log shared.Log `mapstructure:"log"`
Log *shared.Log `mapstructure:"log"`
Debug Debug `mapstructure:"debug"`
HTTP HTTP `mapstructure:"http"`
Service Service `mapstructure:"service"`
@@ -199,10 +199,9 @@ func New() *Config {
}
}
// DefaultConfig are values stored in the flag set, but moved to a struct.
// DefaultConfig provides with a working local configuration for a proxy service.
func DefaultConfig() *Config {
return &Config{
Log: shared.Log{}, // logging config is inherited.
Debug: Debug{
Addr: "0.0.0.0:9205",
Token: "",
+4 -4
View File
@@ -4,10 +4,10 @@ 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() []string {
var r = make([]string, len(structMappings(&Config{})))
for i := range structMappings(&Config{}) {
r = append(r, structMappings(&Config{})[i].EnvVars...)
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