envilder
Version:
A CLI and GitHub Action that securely centralizes your environment variables from AWS SSM or Azure Key Vault as a single source of truth
64 lines • 2.46 kB
TypeScript
import type { SecretProviderType } from '../domain/secret-provider-type.js';
/**
* Facade for loading secrets from cloud providers.
*
* Supports loading from a single map file or from an
* environment-based mapping that routes each environment name
* to its own map file (or `null` to skip).
*
* @example
* ```typescript
* // One-liner — resolve + inject into process.env:
* await Envilder.load('envilder.json');
*
* // Resolve without injecting:
* const secrets = await Envilder.resolveFile('envilder.json');
*
* // Fluent builder with provider override:
* const secrets = await Envilder.fromMapFile('envilder.json')
* .withProvider(SecretProviderType.Azure)
* .withVaultUrl('https://my-vault.vault.azure.net')
* .inject();
* ```
*/
export declare class Envilder {
private readonly filePath;
private options;
private constructor();
/**
* Returns a fluent builder bound to the given map file.
*
* Chain `.withProvider()`, `.withVaultUrl()`, or `.withProfile()`
* before calling `.resolve()` or `.inject()`.
*/
static fromMapFile(filePath: string): Envilder;
/**
* Resolves secrets and injects them into `process.env`.
*
* Can be called in two ways:
* - `load(filePath)` — load from a single map file
* - `load(env, envMapping)` — look up env in the mapping
*/
static load(filePathOrEnv: string, envMapping?: Record<string, string | null>): Promise<Map<string, string>>;
/**
* Resolves secrets without injecting into `process.env`.
*
* Can be called in two ways:
* - `resolveFile(filePath)` — resolve from a single map file
* - `resolveFile(env, envMapping)` — look up env in the mapping
*/
static resolveFile(filePathOrEnv: string, envMapping?: Record<string, string | null>): Promise<Map<string, string>>;
/** Override the secret provider (AWS or Azure). */
withProvider(provider: SecretProviderType): Envilder;
/** Override the Azure Key Vault URL. */
withVaultUrl(vaultUrl: string): Envilder;
/** Override the AWS named profile. */
withProfile(profile: string): Envilder;
/** Resolve secrets and return them as a Map. */
resolve(): Promise<Map<string, string>>;
/** Resolve secrets, inject into `process.env`, and return them. */
inject(): Promise<Map<string, string>>;
private parseFile;
private buildOptions;
}
//# sourceMappingURL=envilder.d.ts.map