Allow proxy-only dashboard auth
This commit is contained in:
parent
77464b8030
commit
bd282b4dc3
2 changed files with 7 additions and 2 deletions
|
|
@ -159,6 +159,8 @@ NPM’s Access Lists use browser `Authorization` headers, so the app never needs
|
||||||
|
|
||||||
NPM’s own docs call out that Access List basic auth and app-side auth both use `Authorization`, so the app-side login is the one to disable in production.
|
NPM’s own docs call out that Access List basic auth and app-side auth both use `Authorization`, so the app-side login is the one to disable in production.
|
||||||
|
|
||||||
|
If `DASHBOARD_USERNAME` and `DASHBOARD_PASSWORD_HASH` are omitted, the app now falls back to proxy-only mode automatically.
|
||||||
|
|
||||||
For direct local Docker testing without a proxy:
|
For direct local Docker testing without a proxy:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|
|
||||||
|
|
@ -603,8 +603,11 @@ def dashboard_auth_from_env() -> DashboardAuth | None:
|
||||||
if bool_env("DASHBOARD_AUTH_DISABLED", False):
|
if bool_env("DASHBOARD_AUTH_DISABLED", False):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
username = env("DASHBOARD_USERNAME")
|
username = os.getenv("DASHBOARD_USERNAME", "").strip()
|
||||||
encoded_hash = env("DASHBOARD_PASSWORD_HASH")
|
encoded_hash = os.getenv("DASHBOARD_PASSWORD_HASH", "").strip()
|
||||||
|
if not username or not encoded_hash:
|
||||||
|
return None
|
||||||
|
|
||||||
ttl = int(os.getenv("DASHBOARD_SESSION_TTL_SECONDS", "28800"))
|
ttl = int(os.getenv("DASHBOARD_SESSION_TTL_SECONDS", "28800"))
|
||||||
secure = bool_env("DASHBOARD_COOKIE_SECURE", False)
|
secure = bool_env("DASHBOARD_COOKIE_SECURE", False)
|
||||||
return DashboardAuth(
|
return DashboardAuth(
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue