diff --git a/config.ts b/config.ts index 5a151cc..f4f8aed 100644 --- a/config.ts +++ b/config.ts @@ -10,11 +10,10 @@ let staticUsers; try { const yamlContent = await Deno.readTextFile(`${dirname}/users.yaml`); staticUsers = parse(yamlContent); - log("Static user config:", "blue"); - log(Deno.inspect(staticUsers), "blue"); + log(`Serving content for ${Object.keys(staticUsers).length} pubkeys from users.yaml`, "blue"); } catch { staticUsers = {}; - log(`Could not find or parse a "users.yaml" config`, "yellow"); + log(`Could not find or parse a users.yaml config`, "yellow"); } const relay_urls = Deno.env.get("RELAY_URLS")?.split(","); @@ -33,6 +32,22 @@ const config = { }, }; -log(`LDAP enabled: ${config.ldapEnabled}`, "blue"); +if (config.ldapEnabled && config.ldap.url) { + log(`Serving content for pubkeys from ${config.ldap.url}`, "blue"); +} else { + log(`LDAP not enabled`, "blue"); +} + +if (Object.keys(staticUsers).length === 0 && !config.ldapEnabled) { + log(`Neither static users nor LDAP configured. Nothing to serve.`); + Deno.exit(1); +} + +if (config.relay_urls?.length > 0) { + log(`Relays: ${config.relay_urls.join(", ")}`, "green"); +} else { + log(`No relays configured. Please add at least one relay to RELAY_URLS.`); + Deno.exit(1); +} export default config;