@@ -19,8 +19,32 @@ import (
1919)
2020
2121const (
22- baseLoginURL = "https://dash.cloudflare.com/argotunnel"
23- callbackStoreURL = "https://login.cloudflareaccess.org/"
22+ baseLoginURL = "https://dash.cloudflare.com/argotunnel"
23+ callbackURL = "https://login.cloudflareaccess.org/"
24+ // For now these are the same but will change in the future once we know which URLs to use (TUN-8872)
25+ fedBaseLoginURL = "https://dash.cloudflare.com/argotunnel"
26+ fedCallbackStoreURL = "https://login.cloudflareaccess.org/"
27+ fedRAMPParamName = "fedramp"
28+ loginURLParamName = "loginURL"
29+ callbackURLParamName = "callbackURL"
30+ )
31+
32+ var (
33+ loginURL = & cli.StringFlag {
34+ Name : loginURLParamName ,
35+ Value : baseLoginURL ,
36+ Usage : "The URL used to login (default is https://dash.cloudflare.com/argotunnel)" ,
37+ }
38+ callbackStore = & cli.StringFlag {
39+ Name : callbackURLParamName ,
40+ Value : callbackURL ,
41+ Usage : "The URL used for the callback (default is https://login.cloudflareaccess.org/)" ,
42+ }
43+ fedramp = & cli.BoolFlag {
44+ Name : fedRAMPParamName ,
45+ Aliases : []string {"f" },
46+ Usage : "Login with FedRAMP High environment." ,
47+ }
2448)
2549
2650func buildLoginSubcommand (hidden bool ) * cli.Command {
@@ -30,6 +54,11 @@ func buildLoginSubcommand(hidden bool) *cli.Command {
3054 Usage : "Generate a configuration file with your login details" ,
3155 ArgsUsage : " " ,
3256 Hidden : hidden ,
57+ Flags : []cli.Flag {
58+ loginURL ,
59+ callbackStore ,
60+ fedramp ,
61+ },
3362 }
3463}
3564
@@ -44,9 +73,18 @@ func login(c *cli.Context) error {
4473 return err
4574 }
4675
47- loginURL , err := url .Parse (baseLoginURL )
76+ var (
77+ baseloginURL = c .String (loginURLParamName )
78+ callbackStoreURL = c .String (callbackURLParamName )
79+ )
80+
81+ if c .Bool (fedRAMPParamName ) {
82+ baseloginURL = fedBaseLoginURL
83+ callbackStoreURL = fedCallbackStoreURL
84+ }
85+
86+ loginURL , err := url .Parse (baseloginURL )
4887 if err != nil {
49- // shouldn't happen, URL is hardcoded
5088 return err
5189 }
5290
0 commit comments