mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
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:
co-authored by
Kyle Carberry
parent
25c1e45930
commit
c6b2861493
@@ -1491,6 +1491,31 @@ func TestServer(t *testing.T) {
|
||||
w.RequireSuccess()
|
||||
})
|
||||
})
|
||||
t.Run("DisableDERP", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// Make sure that $CODER_DERP_SERVER_STUN_ADDRESSES can be set to
|
||||
// disable STUN.
|
||||
|
||||
inv, cfg := clitest.New(t,
|
||||
"server",
|
||||
"--in-memory",
|
||||
"--http-address", ":0",
|
||||
"--access-url", "https://example.com",
|
||||
)
|
||||
inv.Environ.Set("CODER_DERP_SERVER_STUN_ADDRESSES", "disable")
|
||||
ptytest.New(t).Attach(inv)
|
||||
clitest.Start(t, inv)
|
||||
gotURL := waitAccessURL(t, cfg)
|
||||
client := codersdk.New(gotURL)
|
||||
|
||||
ctx := testutil.Context(t, testutil.WaitMedium)
|
||||
_ = coderdtest.CreateFirstUser(t, client)
|
||||
gotConfig, err := client.DeploymentConfig(ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Len(t, gotConfig.Values.DERP.Server.STUNAddresses, 0)
|
||||
})
|
||||
}
|
||||
|
||||
func generateTLSCertificate(t testing.TB, commonName ...string) (certPath, keyPath string) {
|
||||
|
||||
Reference in New Issue
Block a user