UNPKG

@naturalcycles/nodejs-lib

Version:
28 lines (27 loc) 1.07 kB
/** * Loads plaintext secrets from process.env, removes them, stores locally. * Make sure to call this function early on server startup, so secrets are removed from process.env * * Does NOT delete previous secrets from secretMap. */ export declare function loadSecretsFromEnv(): void; /** * Removes process.env.SECRET_* */ export declare function removeSecretsFromEnv(): void; /** * Does NOT delete previous secrets from secretMap. * * If SECRET_ENCRYPTION_KEY argument is passed - will decrypt the contents of the file first, before parsing it as JSON. */ export declare function loadSecretsFromJsonFile(filePath: string, SECRET_ENCRYPTION_KEY?: string): void; /** * json secrets are always base64'd */ export declare function secret<T = string>(k: string, json?: boolean): T; export declare function secretOptional<T = string>(k: string, json?: boolean): T | undefined; export declare function getSecretMap(): Record<string, string>; /** * REPLACES secretMap with new map. */ export declare function setSecretMap(map: Record<string, string>): void;