UNPKG

@monkeyscanjump/cloudflare-dyndns

Version:

A robust TypeScript application that automatically updates Cloudflare DNS records when your public IP address changes. Perfect for maintaining consistent domain names for home servers, WireGuard VPN, self-hosted services, or any system with a dynamic IP a

73 lines (72 loc) 2.55 kB
import { IConfig } from '../types'; /** * Manages application configuration from multiple sources * Loads from .env files, environment variables and direct configuration * with priority handling and OS-specific paths */ export declare class ConfigManager { private config; /** * Required configuration parameters for the application to function * These must be provided or the validation will fail */ private requiredEnvVars; /** * Creates a new configuration manager * @param directConfig Optional configuration values to override environment variables */ constructor(directConfig?: Partial<IConfig>); /** * Sets a configuration value and updates dependent values * @param key Configuration key to set * @param value New value for the configuration key */ set<K extends keyof IConfig>(key: K, value: IConfig[K]): void; /** * Builds a fully qualified domain name from subdomain and domain parts * @param subdomain Subdomain component * @param domain Domain component * @returns Formatted FQDN or empty string if insufficient parts */ private constructFqdn; /** * Loads environment variables from multiple locations in priority order * Tries several common paths for .env files */ private loadEnvironmentVariables; /** * Creates directories needed for logs and IP storage if they don't exist */ private ensureDirectoriesExist; /** * Determines the appropriate log file path based on the current OS * @returns OS-specific default log path */ private getDefaultLogPath; /** * Determines the appropriate IP storage file path based on the current OS * @returns OS-specific default path for storing the last known IP */ private getDefaultIpStoragePath; /** * Validates that all required configuration parameters are present * @throws Error if required configuration is missing */ validate(): void; /** * Gets a specific configuration value * @param key Configuration key to retrieve * @returns Value for the specified configuration key */ get<K extends keyof IConfig>(key: K): IConfig[K]; /** * Gets a copy of the entire configuration object * @returns Complete configuration object */ getAll(): IConfig; /** * Checks if all required configuration exists * @returns True if all required config parameters are present and non-empty */ configExists(): boolean; }