UNPKG

lemon-devkit

Version:

Lemon Serverless Micro-Service Platform for local development

87 lines (86 loc) 2.45 kB
import { EnvironmentSet } from 'lemon-core/dist/environ'; /** * type: `CrendentialForAWS` * - common interface for AWS credentials. * - used for `AWS.config.credentials` or `AWS.Credentials` */ export interface CrendentialForAWS { /** * AWS access key ID */ readonly accessKeyId: string; /** * AWS secret access key */ readonly secretAccessKey: string; /** * A security or session token to use with these credentials. Usually * present for temporary credentials. */ readonly sessionToken?: string; /** (optional) the loaded profile name if applicable */ readonly profile?: string; } /** * Simple string set */ type SimpleStringSet = { [key: string]: string; }; /** * loader `<profile>.yml` * * **Determine Environ Target** * 1. ENV 로부터, 로딩할 `env.yml` 파일을 지정함. * 2. STAGE 로부터, `env.yml`내 로딩할 환경 그룹을 지정함. * * example: * `$ ENV=lemon STAGE=dev nodemon express.js --port 8081` * * @param process the main process instance. * @param options (optional) default option. */ export declare const loadEnviron: (process: any, options?: EnvironmentSet) => SimpleStringSet; interface Logger { (title: string, msg?: string): void; (title: string, ...args: any[]): void; } /** * load AWS credential profile via env.NAME * * ```sh * # load AWS 'lemon' profile, and run test. * $ NAME=lemon npm run test * ```` * @param $proc process (default `global.process`) * @param $info info logger (default `console.info`) * @returns profile-name defined as `NAME` in environment (none is ignored). */ export declare const loadProfile: ($proc?: { env?: any; }, options?: { info?: Logger; }) => string; /** * dynamic loading credentials by profile. (search PROFILE -> NAME) * * !WARN! - could not catch AWS.Error `Profile null not found` via callback. * * @param profile profile name of AWS. * * @deprecated use `asyncCredentials()` instead. */ export declare const credentials: (profile: string) => string; /** * return whether AWS credentials set * * @deprecated use `asyncCredentials` instead. */ export declare const hasCredentials: () => boolean; /** * dynamic loading credentials by profile. (search PROFILE -> NAME) * * @returns {Promise<CrendentialForAWS>} - AWS credentials */ export declare const asyncCredentials: (profile: string) => Promise<CrendentialForAWS>; export {};