Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Config<C, S>

This will load, parse, validate and hold your applications configuration. Use the static create accessor to create a new configuration.

const config = Config.create({
  serviceEnabled: {
    type: Boolean,
    description: 'Determine whether service is enabled',
    default: true,
    env: 'ENABLED'
  },
  serviceUrl: {
    type: String,
    description: 'Public service url for accessing data',
    nullable: true,
  },
})

Type parameters

Hierarchy

  • Config

Index

Methods

Methods

get

  • get<K>(key: K): ConfigType<C, S>[K]
  • Retrieve configuration value.

    Type parameters

    • K: keyof S

    Parameters

    • key: K

      Configuration value key

    Returns ConfigType<C, S>[K]

Static create

  • create<C, S>(schema: S): Config<C, S>
  • Create a new configuration instance, which will include loading and parsing the configuration from process.env.

    Type parameters

    Parameters

    • schema: S

      Configuration schema that will be used for parsing process.env

    Returns Config<C, S>

Generated using TypeDoc