@salesforce/core
    Preparing search index...

    Aggregate global and local project config files, as well as environment variables for config.json. The resolution happens in the following bottom-up order:

    1. Environment variables (SF_LOG_LEVEL)
    2. Workspace settings (<workspace-root>/.sf/config.json)
    3. Global settings ($HOME/.sf/config.json)

    Use ConfigAggregator.create to instantiate the aggregator.

    const aggregator = await ConfigAggregator.create();
    console.log(aggregator.getPropertyValue('target-org'));

    Hierarchy

    Index
    • Get the resolved config object from the local, global and environment config instances.

      Returns JsonMap

    • Get all resolved config property keys, values, locations, and paths.

      > console.log(aggregator.getConfigInfo());
      [
      { key: 'logLevel', val: 'INFO', location: 'Environment', path: '$SF_LOG_LEVEL'}
      { key: 'target-org', val: '<username>', location: 'Local', path: './.sf/config.json'}
      ]

      Returns ConfigInfo[]

    • Get a resolved config property. If a property is deprecated, it will try to use the the new key, if there is a config there.

      Parameters

      • key: string

        The key of the property.

      • throwOnDeprecation: boolean = false

        True, if you want an error throw when reading a deprecated config

      Returns ConfigInfo

    • Gets a resolved config property location.

      For example, getLocation('logLevel') will return:

      1. Location.GLOBAL if resolved to an environment variable.
      2. Location.LOCAL if resolved to local project config.
      3. Location.ENVIRONMENT if resolved to the global config.

      Parameters

      • key: string

        The key of the property.

      Returns Optional<Location>

    • Get a resolved file path or environment variable name of the property.

      For example, getPath('logLevel') will return:

      1. $SF_LOG_LEVEL if resolved to an environment variable.
      2. ./.sf/config.json if resolved to the local config.
      3. ~/.sf/config.json if resolved to the global config.
      4. undefined, if not resolved.

      Note: that the path returned may be the absolute path instead of relative paths such as ./ and ~/.

      Parameters

      • key: string

        The key of the property.

      Returns Optional<string>

    • Get a resolved config property meta. If the property is deprecated, it will return the new key's meta, if it exists, with a deprecation warning

      Throws SfError{ name: 'UnknownConfigKeyError' } An attempt to get a property that's not supported.

      Parameters

      • key: string

        The key of the property.

      Returns ConfigPropertyMeta

    • Get a resolved config property. If you use a deprecated property, a warning will be emitted and it will attempt to resolve the new property's value

      Throws SfError{ name: 'UnknownConfigKeyError' } An attempt to get a property that's not supported.

      Type Parameters

      • T extends AnyJson

      Parameters

      • key: string

        The key of the property.

      Returns Optional<T>

    • Initialize this instances async dependencies.

      Returns Promise<void>

    • Clear the cache to force reading from disk. If no projectPath is provided, all instances will be cleared.

      NOTE: Only call this method if you must and you know what you are doing.

      Parameters

      • OptionalprojectPath: string

      Returns Promise<void>