ExperimentalOptional ExperimentalchangeHow the source detects file changes. The two modes are alternatives.
polling, the default, examines the files on a fixed interval and reloads when the
modification time or the size of a file changes. It works on every filesystem, including
network mounts and directories whose contents are swapped through symbolic links.
watching reloads in response to filesystem change notifications for the directories that
contain the files. It reacts faster than polling. It depends on notifications, which some
filesystems do not deliver reliably.
Optional ExperimentalduplicateWhat to do when the same flag or segment key appears in more than one file. fail, the
default, treats the reload as failed and keeps the previously loaded overrides. ignore
keeps the entry from the first configured file that defines the key and discards the others.
ExperimentalpathsThe paths of the files to read, in precedence order. At least one path is required. The order decides which file wins under the duplicate keys handling when the same key appears in more than one file.
Optional ExperimentalpollThe interval between examinations of the files in polling mode, in seconds. The default is
ExperimentaltypeOptional ExperimentalyamlA YAML parser for YAML files. The SDK does not include one; to read YAML files, supply a
parser that produces the same structure as JSON.parse, for example the parse function
of the yaml package. A YAML file configured without a parser fails client construction.
A result of null or undefined, which YAML parsers return for an empty file, means that the
file has no entries.
Configuration of the file-based override source.
The source reads flag and segment overrides from one or more local files and reloads them as the files change. The files use the same document format as the file data source: a JSON or YAML document with optional
flags,flagValues, andsegmentsmembers. A file whose name ends in.ymlor.yamlis YAML, and any other file is JSON; files are read as UTF-8.flagValuesentries expand into full flag definitions that return the given value for every context. AflagValuesentry is not available to client-side SDKs, soallFlagsStatewithclientSideOnlyleaves it out, even when the flag it overrides is available to them. To override such a flag, define it inflagswith"clientSideAvailability": { "usingEnvironmentId": true }.A configured file that does not exist contributes no overrides. It can be created later, and deleting it removes its overrides. If a file that exists cannot be read or parsed, the previously loaded overrides stay in effect, the failure is logged, and the source loads the file once it is valid again. A file that contains an entry marked as deleted fails to load in the same way; to remove an override, remove its entry or delete the file. Every applied change is logged at Info level with the overrides in effect and what each file supplied.
Files can be rewritten in place: if the source finds a file empty while it is being rewritten, it keeps the overrides in effect until the new content is written. To remove a file's overrides, delete the file or write a document with no entries, such as
{}. An empty JSON file is not a valid document. For a YAML file, replacing its contents in one operation, such as by renaming a fully written temporary file over it, avoids briefly applying a partly written file.Example
Flag overrides are currently experimental and subject to change.