mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-15 23:12:04 +00:00
fix(admin): read a geolocation provider the operator named as a decision, not a warning
This commit is contained in:
1 parent
88836452eb
commit
0a6811c03f
16 files changed
+157
-14
No files matched your search
@@ -169,6 +169,24 @@ export function resolveGeoProviderHost(): string {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* How login IPs are placed on this host: from the mounted GeoLite2 databases,
|
||||
* by the online provider, or not at all (`IP_GEO_LOOKUP_DISABLED`).
|
||||
*/
|
||||
export function geoLookupMode(): "offline" | "online" | "off" {
|
||||
if (offlineGeoReady()) return "offline";
|
||||
return envFlag("IP_GEO_LOOKUP_DISABLED") ? "off" : "online";
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the operator named the online provider (`IP_GEO_LOOKUP_URL`).
|
||||
* An explicit provider is a decision about where login IPs go; the default
|
||||
* is not, so the admin status only warns about the default.
|
||||
*/
|
||||
export function geoProviderChosen(): boolean {
|
||||
return Boolean(process.env.IP_GEO_LOOKUP_URL?.trim());
|
||||
}
|
||||
|
||||
/**
|
||||
* Directory the offline MMDBs are read from.
|
||||
*
|
||||
|
||||
@@ -239,6 +239,16 @@ const versionResponse = z
|
||||
.describe(
|
||||
"Host of the online geolocation provider the fallback would use, so an operator surface names the real one instead of assuming the default.",
|
||||
),
|
||||
geoLookup: z
|
||||
.enum(["offline", "online", "off"])
|
||||
.describe(
|
||||
"How login IPs are placed (since v1.42): `offline` from the GeoLite2 databases, `online` by the provider above, `off` not at all (`IP_GEO_LOOKUP_DISABLED`).",
|
||||
),
|
||||
geoProviderChosen: z
|
||||
.boolean()
|
||||
.describe(
|
||||
"The operator named the online provider in `IP_GEO_LOOKUP_URL` (since v1.42). False while the default is in use.",
|
||||
),
|
||||
})
|
||||
.meta({
|
||||
id: "VersionResponse",
|
||||
|
||||
Reference in new issue
Block a user