- Server: NIP-98 nostr auth (session cookies), BTC Map sync, claim/link/field routes, physical-presence checks via geolocation distance. 31 tests passing. - Frontend: Leaflet map, team pick, claim/link UI, Archipelago identity bridge vendored (nostr-provider.js) for dashboard launch support. - Verified end-to-end against the live BTC Map API (167 real Madeira places) and via genuine NIP-98-signed HTTP requests against the built app.
24 lines
945 B
TypeScript
24 lines
945 B
TypeScript
import { z } from 'zod';
|
|
|
|
const envSchema = z.object({
|
|
PORT: z.coerce.number().default(8096),
|
|
HOST: z.string().default('0.0.0.0'),
|
|
DATA_DIR: z.string().default('./data'),
|
|
STATIC_DIR: z.string().optional(),
|
|
PUBLIC_URL: z.string().url().default('http://localhost:8096'),
|
|
NIP98_MAX_SKEW_SECS: z.coerce.number().default(60),
|
|
SESSION_TTL_DAYS: z.coerce.number().default(30),
|
|
// Default sync area: Madeira, Portugal (Funchal-centered radius covering the whole island).
|
|
BTCMAP_CENTER_LAT: z.coerce.number().default(32.7607),
|
|
BTCMAP_CENTER_LON: z.coerce.number().default(-16.9595),
|
|
BTCMAP_RADIUS_KM: z.coerce.number().default(45),
|
|
// How close (in meters) a player must be to a place to claim it or link from it.
|
|
CLAIM_RADIUS_METERS: z.coerce.number().default(40),
|
|
});
|
|
|
|
export type Config = z.infer<typeof envSchema>;
|
|
|
|
export function loadConfig(env: NodeJS.ProcessEnv = process.env): Config {
|
|
return envSchema.parse(env);
|
|
}
|