@@ -13,8 +13,7 @@ import (
13
13
"github.com/mreiferson/go-options"
14
14
)
15
15
16
- func main () {
17
- log .SetFlags (log .Ldate | log .Ltime | log .Lshortfile )
16
+ func mainFlagSet () * flag.FlagSet {
18
17
flagSet := flag .NewFlagSet ("oauth2_proxy" , flag .ExitOnError )
19
18
20
19
emailDomains := StringArray {}
@@ -24,9 +23,6 @@ func main() {
24
23
googleGroups := StringArray {}
25
24
gitlabGroups := StringArray {}
26
25
27
- config := flagSet .String ("config" , "" , "path to config file" )
28
- showVersion := flagSet .Bool ("version" , false , "print version string" )
29
-
30
26
flagSet .String ("http-address" , "127.0.0.1:4180" , "[http://]<addr>:<port> or unix://<path> to listen on for HTTP clients" )
31
27
flagSet .String ("https-address" , ":443" , "<addr>:<port> to listen on for HTTPS clients" )
32
28
flagSet .String ("tls-cert" , "" , "path to certificate file" )
@@ -85,6 +81,16 @@ func main() {
85
81
86
82
flagSet .String ("signature-key" , "" , "GAP-Signature request signature key (algorithm:secretkey)" )
87
83
84
+ return flagSet
85
+ }
86
+
87
+ func main () {
88
+ log .SetFlags (log .Ldate | log .Ltime | log .Lshortfile )
89
+ flagSet := mainFlagSet ()
90
+
91
+ config := flagSet .String ("config" , "" , "path to config file" )
92
+ showVersion := flagSet .Bool ("version" , false , "print version string" )
93
+
88
94
flagSet .Parse (os .Args [1 :])
89
95
90
96
if * showVersion {
0 commit comments