feat: sync public links and phone change updates
This commit is contained in:
parent
41c7f1d018
commit
da04c0fa6a
53 changed files with 3029 additions and 111 deletions
|
|
@ -224,6 +224,38 @@ func TestLoadNormalizesLocalPublicBaseURL(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestLoadRejectsInvalidPublicBaseURL(t *testing.T) {
|
||||
disableDefaultConfigFile(t)
|
||||
t.Setenv("TELESRV_PUBLIC_BASE_URL", "https://links.example.test/root?tenant=one")
|
||||
|
||||
if _, err := Load(); err == nil {
|
||||
t.Fatal("Load succeeded with a query-bearing public base URL")
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadExplicitEmptyEnvironmentDisablesNullableListeners(t *testing.T) {
|
||||
path := filepath.Join(t.TempDir(), "telesrv.env")
|
||||
writeConfigFile(t, path, `
|
||||
TELESRV_DEBUG_ADDR=127.0.0.1:6060
|
||||
TELESRV_BOT_API_ADDR=127.0.0.1:8081
|
||||
TELESRV_ADMIN_API_ADDR=127.0.0.1:2599
|
||||
TELESRV_PUBLIC_LINK_WEB_ADDR=127.0.0.1:2401
|
||||
`)
|
||||
t.Setenv("TELESRV_CONFIG", path)
|
||||
t.Setenv("TELESRV_DEBUG_ADDR", "")
|
||||
t.Setenv("TELESRV_BOT_API_ADDR", "")
|
||||
t.Setenv("TELESRV_ADMIN_API_ADDR", "")
|
||||
t.Setenv("TELESRV_PUBLIC_LINK_WEB_ADDR", "")
|
||||
|
||||
cfg, err := Load()
|
||||
if err != nil {
|
||||
t.Fatalf("Load: %v", err)
|
||||
}
|
||||
if cfg.DebugAddr != "" || cfg.BotAPIAddr != "" || cfg.AdminAPIAddr != "" || cfg.PublicLinkWebAddr != "" {
|
||||
t.Fatalf("nullable listeners were not disabled: debug=%q bot=%q admin=%q public=%q", cfg.DebugAddr, cfg.BotAPIAddr, cfg.AdminAPIAddr, cfg.PublicLinkWebAddr)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadEnvironmentOverridesConfigFile(t *testing.T) {
|
||||
path := filepath.Join(t.TempDir(), "telesrv.env")
|
||||
writeConfigFile(t, path, `TELESRV_MAPBOX_TOKEN=file-token`)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue