feat: allow disabling stun addresses via env (#7066)

* feat: allow disabling stun addresses via env

Resolves #6791

* Specify a dummy access URL so the tunnel wouldn't start

* Document

---------

Co-authored-by: Kyle Carberry <kyle@carberry.com>
This commit is contained in:
Ammar Bandukwala
2023-04-17 17:20:26 +00:00
committed by GitHub
co-authored by Kyle Carberry
parent 25c1e45930
commit c6b2861493
6 changed files with 44 additions and 6 deletions
+13
View File
@@ -390,6 +390,19 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
if !cfg.DERP.Server.Enable {
defaultRegion = nil
}
// HACK: see https://github.com/coder/coder/issues/6791.
for _, addr := range cfg.DERP.Server.STUNAddresses {
if addr != "disable" {
continue
}
err := cfg.DERP.Server.STUNAddresses.Replace(nil)
if err != nil {
panic(err)
}
break
}
derpMap, err := tailnet.NewDERPMap(
ctx, defaultRegion, cfg.DERP.Server.STUNAddresses,
cfg.DERP.Config.URL.String(), cfg.DERP.Config.Path.String(),