Options
All
  • Public
  • Public/Protected
  • All
Menu

Typenv Documentation

Index

Type aliases

LoaderOptions

LoaderOptions: IDotEnvLoaderOptions

LoaderType

LoaderType: LoaderOptions["type"]

Variables

Const COMMENT

COMMENT: RegExp = /^\s*#.+$/

Const EMPTY

EMPTY: RegExp = /^\s*$/

Const KEY_METADATA_NAME

KEY_METADATA_NAME: "typenv:key" = "typenv:key"

Const LINE_BREAK

LINE_BREAK: RegExp = /\n|\r|\r\n/

Const PAIR

PAIR: RegExp = /^\s*((?!\s*=).*)\s*=\s*(.+)\s*$/

Functions

Const Key

  • Key(opts: string | IKeyOpts): (Anonymous function)

Const createLoader

getDefaultValue

  • getDefaultValue(target: any, propertyKey: string | symbol, defaultValue: any): any
  • Parameters

    • target: any
    • propertyKey: string | symbol
    • defaultValue: any

    Returns any

Const load

  • Load configuration from supplied class

    remarks

    Load method is dependant on loader.type

    example
    class MyConfig {
      @Key("KEY_NAME")
      public property: string;
    }
    
    await load(MyConfig);

    Type parameters

    • TConfig

    Parameters

    • klass: {}

      Class

    • Default value options: ILoaderOptions = { type: "dotenv" }

      Config options

    • Default value loader: IConfigLoader = createLoader(options)

      Config loader (defaults to loader created by @link createLoader)

    • Default value reflector: Reflector<TConfig> = new Reflector(klass)

      Config reflector (defaults to @link Reflector)

    Returns Promise<TConfig>

Const loadSync

  • Type parameters

    • TConfig

    Parameters

    • ctor: {}
    • Default value options: ILoaderOptions = { type: "dotenv" }
    • Default value loader: IConfigLoader = createLoader(options)
    • Default value reflector: Reflector<TConfig> = new Reflector(ctor)

    Returns TConfig

setDefaultValue

  • setDefaultValue(target: any, propertyKey: string | symbol, defaultValue: any): void
  • Parameters

    • target: any
    • propertyKey: string | symbol
    • defaultValue: any

    Returns void

setMetadata

  • setMetadata(target: any, propertyKey: string | symbol, opts: IKeyOpts): void

Generated using TypeDoc