Function getConfigVariable

  • get config variable from loaders

    Type Parameters

    • Output

    Parameters

    Returns Promise<Output>

    Example

    // from "@avanio/variable-util-node"
    const fileEnv = new FileConfigLoader({fileName: './settings.json', type: 'json'}).getLoader;

    const port: Promise<string> = await getConfigVariable('PORT', [env(), fileEnv()], stringParser, '8080', {showValue: true});
    // with override key
    const port: Promise<string> = await getConfigVariable('PORT', [env('HTTP_PORT', fileEnv())], stringParser, '8080', {showValue: true});
  • Type Parameters

    • Output

    Parameters

    Returns Promise<Output | undefined>