normaliseCouchDBConfiguration (common/couchdbConfiguration.ts)

obsidian-livesync · src/common/couchdbConfiguration.ts · typescript · MIT
database, tag:embed-classified

Normalizes CouchDB configuration objects for Obsidian LiveSync plugin.

// Source: https://github.com/vrtmrz/obsidian-livesync | License: MIT | Copyright 2021 vorotamoroz
// Provided via justclaw.it.com; keep this notice with the code.
type CouchDBConfigurationSection = Record<string, string | undefined>;

export interface CouchDBConfiguration {
    admins: CouchDBConfigurationSection;
    chttpd: CouchDBConfigurationSection;
    chttpd_auth: CouchDBConfigurationSection;
    couchdb: CouchDBConfigurationSection;
    cors: CouchDBConfigurationSection;
    httpd: CouchDBConfigurationSection;
}

function isRecord(value: unknown): value is Record<string, unknown> {
    return typeof value === "object" && value !== null;
}

function normaliseSection(value: unknown): CouchDBConfigurationSection {
    if (!isRecord(value)) {
        return {};
    }

    const entrie

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key