fix yet more offenses
This commit is contained in:
@@ -35,16 +35,6 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(this is not in the cli context anymore)
|
|
||||||
//if origins := ctx.StringSlice("cors-allowed-origins"); len(origins) != 0 {
|
|
||||||
// cfg.HTTP.CORS.AllowedOrigins = origins
|
|
||||||
//}
|
|
||||||
//if methods := ctx.StringSlice("cors-allowed-methods"); len(methods) != 0 {
|
|
||||||
// cfg.HTTP.CORS.AllowedMethods = methods
|
|
||||||
//}
|
|
||||||
//if headers := ctx.StringSlice("cors-allowed-headers"); len(headers) != 0 {
|
|
||||||
// cfg.HTTP.CORS.AllowedOrigins = headers
|
|
||||||
//}
|
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
|
|||||||
@@ -134,29 +134,3 @@ func structMappings(cfg *Config) []mapping {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(refs) What is with the variables with no destination defined?
|
|
||||||
//&cli.StringSliceFlag{
|
|
||||||
//Name: "cors-allowed-origins",
|
|
||||||
//Value: cli.NewStringSlice("*"),
|
|
||||||
//Usage: "Set the allowed CORS origins",
|
|
||||||
//EnvVars: []string{"ACCOUNTS_CORS_ALLOW_ORIGINS", "OCIS_CORS_ALLOW_ORIGINS"},
|
|
||||||
//},
|
|
||||||
//&cli.StringSliceFlag{
|
|
||||||
//Name: "cors-allowed-methods",
|
|
||||||
//Value: cli.NewStringSlice("GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"),
|
|
||||||
//Usage: "Set the allowed CORS origins",
|
|
||||||
//EnvVars: []string{"ACCOUNTS_CORS_ALLOW_METHODS", "OCIS_CORS_ALLOW_METHODS"},
|
|
||||||
//},
|
|
||||||
//&cli.StringSliceFlag{
|
|
||||||
//Name: "cors-allowed-headers",
|
|
||||||
//Value: cli.NewStringSlice("Authorization", "Origin", "Content-Type", "Accept", "X-Requested-With"),
|
|
||||||
//Usage: "Set the allowed CORS origins",
|
|
||||||
//EnvVars: []string{"ACCOUNTS_CORS_ALLOW_HEADERS", "OCIS_CORS_ALLOW_HEADERS"},
|
|
||||||
//},
|
|
||||||
//&cli.BoolFlag{
|
|
||||||
//Name: "cors-allow-credentials",
|
|
||||||
//Value: flags.OverrideDefaultBool(cfg.HTTP.CORS.AllowCredentials, true),
|
|
||||||
//Usage: "Allow credentials for CORS",
|
|
||||||
//EnvVars: []string{"ACCOUNTS_CORS_ALLOW_CREDENTIALS", "OCIS_CORS_ALLOW_CREDENTIALS"},
|
|
||||||
//},
|
|
||||||
|
|||||||
@@ -130,7 +130,6 @@ func New() *Config {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(refs) refactoir refactor this outside
|
|
||||||
type mapping struct {
|
type mapping struct {
|
||||||
EnvVars []string // name of the EnvVars var.
|
EnvVars []string // name of the EnvVars var.
|
||||||
Destination interface{} // memory address of the original config value to modify.
|
Destination interface{} // memory address of the original config value to modify.
|
||||||
@@ -148,7 +147,6 @@ func GetEnv() []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// UnmapEnv loads values from the gooconf.Config argument and sets them in the expected destination.
|
// UnmapEnv loads values from the gooconf.Config argument and sets them in the expected destination.
|
||||||
// TODO(refs) can we avoid repetition here?
|
|
||||||
func (c *Config) UnmapEnv(gooconf *gofig.Config) error {
|
func (c *Config) UnmapEnv(gooconf *gofig.Config) error {
|
||||||
vals := structMappings(c)
|
vals := structMappings(c)
|
||||||
for i := range vals {
|
for i := range vals {
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import (
|
|||||||
gofig "github.com/gookit/config/v2"
|
gofig "github.com/gookit/config/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const defaultIngressURL = "https://localhost:9200"
|
||||||
|
|
||||||
// Log defines the available logging configuration.
|
// Log defines the available logging configuration.
|
||||||
type Log struct {
|
type Log struct {
|
||||||
Level string `mapstructure:"level"`
|
Level string `mapstructure:"level"`
|
||||||
@@ -50,9 +52,9 @@ type Asset struct {
|
|||||||
type WebConfig struct {
|
type WebConfig struct {
|
||||||
Server string `json:"server,omitempty" mapstructure:"server"`
|
Server string `json:"server,omitempty" mapstructure:"server"`
|
||||||
Theme string `json:"theme,omitempty" mapstructure:"theme"`
|
Theme string `json:"theme,omitempty" mapstructure:"theme"`
|
||||||
Version string `json:"version,omitempty" mapstructure:"version"` // TODO what is version used for?
|
Version string `json:"version,omitempty" mapstructure:"version"`
|
||||||
OpenIDConnect OIDC `json:"openIdConnect,omitempty" mapstructure:"oids"`
|
OpenIDConnect OIDC `json:"openIdConnect,omitempty" mapstructure:"oids"`
|
||||||
Apps []string `json:"apps" mapstructure:"apps"` // TODO add nil as empty when https://go-review.googlesource.com/c/go/+/205897/ is released
|
Apps []string `json:"apps" mapstructure:"apps"`
|
||||||
ExternalApps []ExternalApp `json:"external_apps,omitempty" mapstructure:"external_apps"`
|
ExternalApps []ExternalApp `json:"external_apps,omitempty" mapstructure:"external_apps"`
|
||||||
Options map[string]interface{} `json:"options,omitempty" mapstructure:"options"`
|
Options map[string]interface{} `json:"options,omitempty" mapstructure:"options"`
|
||||||
}
|
}
|
||||||
@@ -140,15 +142,15 @@ func DefaultConfig() *Config {
|
|||||||
},
|
},
|
||||||
Web: Web{
|
Web: Web{
|
||||||
Path: "",
|
Path: "",
|
||||||
ThemeServer: "https://localhost:9200",
|
ThemeServer: defaultIngressURL,
|
||||||
ThemePath: "/themes/owncloud/theme.json",
|
ThemePath: "/themes/owncloud/theme.json",
|
||||||
Config: WebConfig{
|
Config: WebConfig{
|
||||||
Server: "https://localhost:9200",
|
Server: defaultIngressURL,
|
||||||
Theme: "",
|
Theme: "",
|
||||||
Version: "0.1.0",
|
Version: "0.1.0",
|
||||||
OpenIDConnect: OIDC{
|
OpenIDConnect: OIDC{
|
||||||
MetadataURL: "",
|
MetadataURL: "",
|
||||||
Authority: "https://localhost:9200",
|
Authority: defaultIngressURL,
|
||||||
ClientID: "web",
|
ClientID: "web",
|
||||||
ResponseType: "code",
|
ResponseType: "code",
|
||||||
Scope: "openid profile email",
|
Scope: "openid profile email",
|
||||||
|
|||||||
Reference in New Issue
Block a user