Move Options and Validation to package

This commit is contained in:
Joel Speed
2020-05-21 22:43:42 +01:00
parent de0c92af06
commit 44b27e0208
10 changed files with 417 additions and 379 deletions
+3 -2
View File
@@ -13,6 +13,7 @@ import (
"github.com/oauth2-proxy/oauth2-proxy/pkg/apis/options"
"github.com/oauth2-proxy/oauth2-proxy/pkg/logger"
"github.com/oauth2-proxy/oauth2-proxy/pkg/validation"
"github.com/spf13/pflag"
)
@@ -148,14 +149,14 @@ func main() {
return
}
opts := NewOptions()
opts := options.NewOptions()
err := options.Load(*config, flagSet, opts)
if err != nil {
logger.Printf("ERROR: Failed to load config: %v", err)
os.Exit(1)
}
err = opts.Validate()
err = validation.Validate(opts)
if err != nil {
logger.Printf("%s", err)
os.Exit(1)