refactor(geoip): reconcile geoip system (#31)

This commit is contained in:
hampus-fluxer authored and GitHub committed 2026-01-05 23:19:05 +01:00
1 parent 5d047b2856
commit 2e007b5076
86 files changed
+982 -2648

No files matched your search

-9
View File
@@ -114,8 +114,6 @@ const ConfigSchema = z.object({
}),
geoip: z.object({
provider: z.enum(['ipinfo', 'maxmind']),
host: z.string().optional(),
maxmindDbPath: z.string().optional(),
}),
@@ -313,12 +311,7 @@ function loadConfig() {
: Array.from(new Set([apiPublicEndpoint, webAppEndpoint, apiClientEndpoint]));
const testModeEnabled = optionalBool('FLUXER_TEST_MODE');
const geoipProviderRaw = optional('GEOIP_PROVIDER')?.trim().toLowerCase();
const geoipProvider = geoipProviderRaw === 'maxmind' ? 'maxmind' : 'ipinfo';
const maxmindDbPath = optional('MAXMIND_DB_PATH');
if (geoipProvider === 'maxmind' && !maxmindDbPath) {
throw new Error('Missing required environment variable: MAXMIND_DB_PATH');
}
return ConfigSchema.parse({
nodeEnv: optional('NODE_ENV') || 'development',
@@ -353,8 +346,6 @@ function loadConfig() {
},
geoip: {
provider: geoipProvider,
host: optional('GEOIP_HOST') || 'geoip',
maxmindDbPath,
},