Skip to content

Commit 98c3957

Browse files
committed
TUN-5010: --region should be a string flag
1 parent 671754f commit 98c3957

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

cmd/cloudflared/tunnel/cmd.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,11 @@ func tunnelFlags(shouldHide bool) []cli.Flag {
494494
EnvVars: []string{"TUNNEL_EDGE"},
495495
Hidden: true,
496496
}),
497+
altsrc.NewStringFlag(&cli.StringFlag{
498+
Name: "region",
499+
Usage: "Cloudflare Edge region to connect to. Omit or set to empty to connect to the global region.",
500+
EnvVars: []string{"TUNNEL_REGION"},
501+
}),
497502
altsrc.NewStringFlag(&cli.StringFlag{
498503
Name: tlsconfig.CaCertFlag,
499504
Usage: "Certificate Authority authenticating connections with Cloudflare's edge network.",

cmd/cloudflared/tunnel/configuration.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ func prepareTunnelConfig(
279279
OSArch: buildInfo.OSArch(),
280280
ClientID: clientID,
281281
EdgeAddrs: c.StringSlice("edge"),
282+
Region: c.String("region"),
282283
HAConnections: c.Int("ha-connections"),
283284
IncidentLookup: origin.NewIncidentLookup(),
284285
IsAutoupdated: c.Bool("is-autoupdated"),

origin/supervisor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func NewSupervisor(config *TunnelConfig, reconnectCh chan ReconnectSignal, grace
7474
if len(config.EdgeAddrs) > 0 {
7575
edgeIPs, err = edgediscovery.StaticEdge(config.Log, config.EdgeAddrs)
7676
} else {
77-
edgeIPs, err = edgediscovery.ResolveEdge(config.Log, "")
77+
edgeIPs, err = edgediscovery.ResolveEdge(config.Log, config.Region)
7878
}
7979
if err != nil {
8080
return nil, err

origin/tunnel.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ type TunnelConfig struct {
4545
ClientID string
4646
CloseConnOnce *sync.Once // Used to close connectedSignal no more than once
4747
EdgeAddrs []string
48+
Region string
4849
HAConnections int
4950
IncidentLookup IncidentLookup
5051
IsAutoupdated bool

0 commit comments

Comments
 (0)