UNPKG

@adpt/cloud

Version:
108 lines 3.67 kB
/** * A single environment variable for a {@link Container}, expressed as an * object with `name` and `value` properties. * * @public */ export interface EnvPair { name: string; value: string; } /** * A set of environment variables for a {@link Container}, expressed as an * array of objects with `name` and `value` properties. * * @remarks * See the * {@link https://docs.docker.com/engine/api/v1.40/#operation/ContainerCreate | Docker API Reference} * for more information. * @public */ export declare type EnvPairs = EnvPair[]; /** * A set of environment variables for a {@link Container}, expressed as a * single object with keys and associated values. * * @remarks * See the * {@link https://docs.docker.com/engine/api/v1.40/#operation/ContainerCreate | Docker API Reference} * for more information. * @public */ export interface EnvSimple { [key: string]: string; } /** * A set of environment variables for a {@link Container}. * * @remarks * See the * {@link https://docs.docker.com/engine/api/v1.40/#operation/ContainerCreate | Docker API Reference} * for more information. * @public */ export declare type Environment = EnvPair[] | EnvSimple; /** * Combine multiple {@link Environment} objects into a single array of * {@link EnvPair} objects. Returns `undefined` if there are no `Environment` * objects provided. * @remarks * If more than one `Environment` object specifies the same environment variable * name, the last one present in the array of arguments takes precedence. * @public */ export declare function mergeEnvPairs(...envs: (Environment | undefined)[]): EnvPairs | undefined; /** * Combine multiple {@link Environment} objects into a single * {@link EnvSimple} object. Returns `undefined` if there are no `Environment` * objects provided. * @remarks * If more than one `Environment` object specifies the same environment variable * name, the last one present in the array of arguments takes precedence. * @public */ export declare function mergeEnvSimple(...envs: (Environment | undefined)[]): EnvSimple | undefined; /** * Renames all variables in `e` based on `mapping` * * @param e - {@link Environment} to rename * @param mapping - Object with `(key, value)` pairs that are `(originalName, newName)` pairs. * * @returns A new {@link Environment} object with all variables renamed according to `mapping` * * @public */ export declare function renameEnvVars(e: Environment, mapping: { [orig: string]: string; }): Environment; /** * Find the value of an environment variable in an {@link Environment} * * @param e - {@link Environment} to search * @param name - variable to search for * @returns the value of the variable name in e, or undefined if not found * * @public */ export declare function lookupEnvVar(e: Environment, name: string): string | undefined; /** * Updates the names and/or values of variables in an {@link Environment} * * @param e - The source {@link Environment} * @param upd - Updated function that returns an EnvPair with the new name and value of the variable * @returns - A new {@link Environment} that is identical to `e` except for the updates done by `upd` * * @public */ export declare function updateEnvVars(e: Environment, upd: (name: string, value: string) => EnvPair | undefined): Environment; /** * Formats an {@link Environment} for printing in human-readable format. * * @param env - The environment to be printed. * @returns - A string representation of the environment for use in logging * or debugging. * * @public */ export declare function formatEnvVars(env: Environment): string; //# sourceMappingURL=env.d.ts.map