UNPKG

@expressots/shared

Version:

Shared library for ExpressoTS modules 🐎

84 lines (83 loc) 2.79 kB
import { IConfigOptions, IConfigOutput, IEnvObject } from "./interfaces"; /** * Module to parse the .env.vault file * @param options - The configuration options * @returns The parsed object */ declare function _parseVault(options: IConfigOptions): IEnvObject; /** * Module to verify and return the .env.vault file path * @param options - The configuration options * @returns The .env.vault file path */ declare function _vaultPath(options: any): any; /** * Module to verify and return the DOTENV_KEY vault key * @param options - The configuration options * @returns The DOTENV_KEY as a string */ declare function _dotenvKey(options?: IConfigOptions): string; /** * Module to get instructions for decrypting the .env.vault file * @param result - * @param dotenvKey * @returns */ declare function _instructions(result: IConfigOutput, dotenvKey: string): { ciphertext: string; key: any; }; /** * Module responsible to resolve home path * @param envPath - The path to resolve * @returns The resolved path */ declare function _resolveHome(envPath: string): string; /** * Module to load environment variables from .env.vault file * @param options - The configuration options * @returns The parsed object */ export declare function _configVault(options: IConfigOptions): IConfigOutput; /** * Module to load environment variables from .env file * @param options - The configuration options * @returns The parsed object * @public API */ export declare function config(options?: IConfigOptions): IConfigOutput; /** * Module to load environment variables from .env file * @param options - The configuration options * @returns The parsed object * @public API */ export declare function configDotenv(options?: IConfigOptions): IConfigOutput; /** * Module to load environment variables from .env file * @param envFile - The source of the .env file * @returns The parsed object * @public API */ export declare function parse(envFile: Buffer | string): Record<string, string>; /** * Decrypts a base64 encoded string * @param encrypted - The base64 encoded string to decrypt * @param keyStr - The key to use for decryption * @returns The decrypted string * @public API */ export declare function decrypt(encrypted: string, keyStr: string): string; /** * Populates the environment with the given parsed object * @param envObject - The object to populate the environment with (e.g. process.env) * @param parsed - The parsed object * @param options - The configuration options * @public API */ export declare function populate(envObject: IEnvObject, // Usually process.env parsed: IEnvObject, options?: IConfigOptions): void; /** * Test swap for private functions */ export { _parseVault, _vaultPath, _dotenvKey, _instructions, _resolveHome };