Optional
options: ConfigFile.OptionsDetermines if the config file is read/write accessible. Returns true
if the user has capabilities specified
by perm.
Optional
perm: numberThe permission.
See https://nodejs.org/dist/latest/docs/api/fs.html#fs_fs_access_path_mode_callback
Determines if the config file is read/write accessible. Returns true
if the user has capabilities specified
by perm.
Optional
perm: numberThe permission.
See https://nodejs.org/dist/latest/docs/api/fs.html#fs_fs_access_path_mode_callback
Returns an array of ConfigEntry for each element in the config.
Invokes actionFn
once for each key-value pair present in the config object.
The function (key: string, value: ConfigValue) => void
to be called for each element.
Returns the value associated to the key, or undefined if there is none.
The key (object property)
Optional
decrypt: booleanIf it is an encrypted key, decrypt the value. If the value is an object, a clone will be returned.
Optional
decrypt: booleanReturns the entire config contents.
NOTE: Data will still be encrypted unless decrypt is passed in. A clone of the data will be returned to prevent storing un-encrypted data in memory and potentially saving to the file system.
Returns the absolute path to the config file.
The first time getPath is called, the path is resolved and becomes immutable. This allows implementers to override options properties, like filePath, on the init method for async creation. If that is required for creation, the config files can not be synchronously created.
Get an individual property config.
Throws SfError{ name: 'UnknownConfigKeyError' } An attempt to get a property that's not supported.
The name of the property.
Read, assign, and return the config contents.
Read the config file and set the config contents. Returns the config contents of the config file. As an
optimization, files are only read once per process and updated in memory and via write()
. To force
a read from the filesystem pass force=true
.
Throws SfError{ name: 'UnexpectedJsonFileFormat' } There was a problem reading or parsing the file.
Optionally indicate if a throw should occur on file read.
Sets a value for a property.
Throws SfError{ name: 'UnknownConfigKeyError' } An attempt to get a property that's not supported. Throws SfError{ name: 'InvalidConfigValueError' } If the input validator fails.
The property to set.
The value of the property.
Convert an object to a ConfigContents and set it as the config contents.
The object.
Convert the config object to a JSON object. Returns the config contents. Same as calling ConfigStore.getContents
Writes Config properties taking into account encrypted properties.
DO NOT CALL - The config file needs to encrypt values which can only be done asynchronously. Call SfdxConfig.write instead.
Throws SfError{ name: 'InvalidWriteError' } Always.
Optional
newContents: ConfigPropertiesContents to write
Static
addAdd an array of allowed config properties.
Array of objects to set as the allowed config properties.
Static
clearStatic
getReturns an array of objects representing the allowed config properties.
Static
getReturns the default options for the config file.
If the file should be stored globally or locally.
Optional
filename: stringThe name of the config file.
Static
getStatic
getStatic
resolveStatic
resolveStatic
updateThe value of a supported config property.
True for a global config. False for a local config.
The name of the property to set.
Optional
value: Optional<AnyJson>The property value.
The files where sfdx config values are stored for projects and the global space.
Note: It is not recommended to instantiate this object directly when resolving config values. Instead use ConfigAggregator
https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_cli_config_values.htm