UNPKG

@pallad/app-env

Version:

Detects environment (production, staging, test, development, ci) and helps making decision based on that

19 lines (18 loc) 840 B
import { AnyInfo, InfoInferEnvNames } from "./Info"; import { Builder as BaseBuilder } from '@pallad/builder'; export declare class Builder<T = undefined, TInfo extends AnyInfo = AnyInfo> extends BaseBuilder { readonly info: TInfo; private found; private value; constructor(info: TInfo); private evalRule; forEnv<TN>(names: Array<InfoInferEnvNames<TInfo>>, value: TN | ((info: TInfo) => TN)): Builder<T | TN, TInfo>; forCI<TN>(value: TN): Builder<T | TN, TInfo>; forProduction<TN>(value: TN): Builder<T | TN, TInfo>; forTest<TN>(value: TN): Builder<T | TN, TInfo>; forDevelopment<TN>(value: TN): Builder<T | TN, TInfo>; forPreview<TN>(value: TN): Builder<T | TN, TInfo>; forStaging<TN>(value: TN): Builder<T | TN, TInfo>; get(): T; getOrDefault<TN>(value: TN): NonNullable<T> | TN; }