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
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.
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.
Optional
throwOnNotFound: boolean = falseOptionally indicate if a throw should occur on file read.
Optional
force: boolean = falseOptionally force the file to be read from disk even when already read within the process.
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.
Optional
throwOnNotFound: boolean = falseOptionally indicate if a throw should occur on file read.
Optional
force: boolean = falseOptionally force the file to be read from disk even when already read within the process.
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
Write the config file with new contents. If no new contents are provided it will write the existing config contents that were set from ConfigFile.read, or an empty file if ConfigFile.read was not called.
Write the config file with new contents. If no new contents are provided it will write the existing config contents that were set from ConfigFile.read, or an empty file if ConfigFile.read was not called.
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
getGets the config options for a given org ID.
The orgId. Generally this org would have multiple users configured.
Static
resolveStatic
resolve
A config file that stores usernames for an org.