docker-swarm-secrets
Version:
A manager for Docker secrets that features customizable secret parsing and async I/O.
30 lines • 1.72 kB
TypeScript
/// <reference types="node" />
import { DSSInterpreter } from '../reader/dss-reader';
/** Encoding types supported by the default `asText` interpreter. */
export declare type SupportedEncoding = 'utf8' | 'utf-8' | 'ucs2' | 'ucs-2' | 'utf16le' | 'utf16-le' | 'ascii' | 'hex' | 'base64' | 'binary' | 'latin1';
/** JSON basic typing */
export declare type JSON = {
[key: string]: string | number | boolean | Date | JSON | JSON[];
};
/** Provides a set of ready-to-use Interpreter functions for use with Docker Swarm Secrets. */
export declare class DefaultInterpreters {
/** Returns the raw data buffer as the secret contents, or undefined if the secret did not exist. */
static asBuffer(): DSSInterpreter<Buffer | undefined>;
/**
* Returns a plain text string as the secret contents, or undefined if the secret did not exist.
* @param encoding The text encoding to use. Default `utf8`.
*/
static asText(encoding?: SupportedEncoding): DSSInterpreter<string | undefined>;
/**
* Returns a JSON object as the secret contents, or undefined if the secret did not exist or was not valid JSON.
* @param encoding The text encoding to use. Default `utf8`.
*/
static asJSON(encoding?: SupportedEncoding): DSSInterpreter<JSON | undefined>;
/**
* Returns a JSON object if the secret contains valid JSON, or a string if it does not. Returns undefined if the secret does not exist.
* This interpreter provides the default behavior from `v1.x.x`.
* @param encoding The text encoding to use. Default `utf8`.
*/
static asTextOrJSON(encoding?: SupportedEncoding): DSSInterpreter<JSON | string | undefined>;
}
//# sourceMappingURL=default-interpreters.d.ts.map