lemon-core
Version:
Lemon Serverless Micro-Service Platform
68 lines (67 loc) • 1.73 kB
TypeScript
import { STAGE, CoreKmsService, CoreConfigService } from './../core-services';
export declare type ConfigService = CoreConfigService;
/**
* filter function()
*/
export interface Filter<T> {
(name: string, val: any, thiz?: any, attr?: string | number): T;
}
/**
* marshaler: convert object to dotted list.
*
* @param obj json object
* @param name current name
* @param list result list
* @param filter filter function.
*/
export declare const marshal: <T>(obj: any, filter: Filter<T>, name?: string, list?: T[], thiz?: any, attr?: string | number) => T[];
/**
* class: `MyConfigService`
* - sample for asynchronized factory.
*/
export declare class MyConfigService implements ConfigService {
/**
* internal cached config settings.
*/
protected envConfig: {
[key: string]: string;
};
protected $env: any;
protected base: any;
kms: CoreKmsService;
/**
* DO NOT craete directly. (use async `ConfigService.factory()`)
*/
constructor(base?: object, kms?: CoreKmsService);
/**
* hello
*/
hello: () => string;
/**
* read all configuration setting
*/
all(): {
[key: string]: string;
};
/**
* read config value (or all config settings)
* 1. read via internal cache.
* 2. if missed, then read via process.env.
*
* @param key config-name.
*/
get(key: string): string;
private _package;
private loadPackage;
getService(): string;
getVersion(): string;
/**
* read current stage condition
*/
getStage(): STAGE;
/**
* load & decrypt the environ.
* - only if string starts with '*'
*/
init(): Promise<ConfigService>;
}