fix: isolate WEB_UI_HOST env var in test and handle empty string
- Patch WEB_UI_HOST in test_web_defaults to avoid env leak - Handle empty WEB_UI_HOST string in config (fall back to 127.0.0.1)
This commit is contained in:
parent
5b47b87c42
commit
fa2c825e2f
2 changed files with 2 additions and 1 deletions
|
|
@ -478,7 +478,7 @@ def _apply_env_overrides(config: GatewayConfig) -> None:
|
||||||
config.platforms[Platform.WEB].enabled = True
|
config.platforms[Platform.WEB].enabled = True
|
||||||
config.platforms[Platform.WEB].extra.update({
|
config.platforms[Platform.WEB].extra.update({
|
||||||
"port": int(os.getenv("WEB_UI_PORT", "8765")),
|
"port": int(os.getenv("WEB_UI_PORT", "8765")),
|
||||||
"host": os.getenv("WEB_UI_HOST", "127.0.0.1"),
|
"host": os.getenv("WEB_UI_HOST", "") or "127.0.0.1",
|
||||||
"token": os.getenv("WEB_UI_TOKEN", ""),
|
"token": os.getenv("WEB_UI_TOKEN", ""),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,7 @@ class TestConfigEnvOverrides(unittest.TestCase):
|
||||||
@patch.dict(os.environ, {
|
@patch.dict(os.environ, {
|
||||||
"WEB_UI_ENABLED": "true",
|
"WEB_UI_ENABLED": "true",
|
||||||
"WEB_UI_TOKEN": "",
|
"WEB_UI_TOKEN": "",
|
||||||
|
"WEB_UI_HOST": "",
|
||||||
}, clear=False)
|
}, clear=False)
|
||||||
def test_web_defaults(self):
|
def test_web_defaults(self):
|
||||||
config = GatewayConfig()
|
config = GatewayConfig()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue