config: sync admin and RTMP port defaults
This commit is contained in:
parent
597b5f265b
commit
c5dc2b7e21
6 changed files with 35 additions and 8 deletions
|
|
@ -19,6 +19,8 @@ import (
|
|||
"telesrv/internal/config"
|
||||
)
|
||||
|
||||
const defaultAdminAPIAddr = "127.0.0.1:2599"
|
||||
|
||||
func main() {
|
||||
if err := run(); err != nil {
|
||||
log.Fatal(err)
|
||||
|
|
@ -81,7 +83,7 @@ func loadConfig() (uiConfig, error) {
|
|||
|
||||
adminAPIAddr := appCfg.AdminAPIAddr
|
||||
if strings.TrimSpace(adminAPIAddr) == "" {
|
||||
adminAPIAddr = "127.0.0.1:2399"
|
||||
adminAPIAddr = defaultAdminAPIAddr
|
||||
}
|
||||
|
||||
if appCfg.AdminUIPassword == "" && appCfg.AdminUIToken == "" {
|
||||
|
|
@ -109,7 +111,7 @@ func loadConfig() (uiConfig, error) {
|
|||
func adminAPIURL(addr string) string {
|
||||
addr = strings.TrimSpace(addr)
|
||||
if addr == "" {
|
||||
addr = "127.0.0.1:2399"
|
||||
addr = defaultAdminAPIAddr
|
||||
}
|
||||
if strings.HasPrefix(addr, "http://") || strings.HasPrefix(addr, "https://") {
|
||||
return strings.TrimRight(addr, "/")
|
||||
|
|
|
|||
|
|
@ -42,3 +42,9 @@ func TestSPAFallbackSmoke(t *testing.T) {
|
|||
t.Fatalf("spa body missing root: %s", rec.Body.String())
|
||||
}
|
||||
}
|
||||
|
||||
func TestAdminAPIURLDefaultUsesAdminAPIPort(t *testing.T) {
|
||||
if got, want := adminAPIURL(""), "http://127.0.0.1:2599"; got != want {
|
||||
t.Fatalf("adminAPIURL(empty) = %q, want %q", got, want)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ export default defineConfig({
|
|||
server: {
|
||||
port: 2410,
|
||||
proxy: {
|
||||
"/api": "http://127.0.0.1:2400"
|
||||
"/api": "http://127.0.0.1:2600"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue