ConfigFile

object ConfigFile

Props' lowest-priority source: a JSON object whose keys ARE the -D property names, so the flag tables in the README are its whole schema and there is no second vocabulary to keep in step.

Read at init and not watched afterwards: by the time an edit could be noticed the port is bound and the token is baked into the endpoint, so a reload would change nothing.

Values are strings, as -D values are. Gson coerces an unquoted number or boolean, so 25599 and "25599" both work; one it cannot coerce fails the whole file rather than that one key.

Properties

Link copied to clipboard
private var entries: Map<String, String?>
Link copied to clipboard

Why the file could not be parsed, or null.

Functions

Link copied to clipboard

Verbatim, nulls and blanks included: Props owns the one unset rule across all three sources.

Link copied to clipboard
fun load()

Parse the file if it is there. Absent is not a failure — it is written on demand. The one writer of failure: persist runs after both its readers, so a failure there has to throw instead.

Link copied to clipboard
fun persist(generated: Map<String, String>, seed: List<String>)

Merge generated into the file and publish it atomically, creating it if it isn't there.

Link copied to clipboard
private fun read(p: Path): Result<Map<String, String?>>

The file's entries — an empty map when it is absent — or what stopped the parse. A query, so the whole answer is the return value: what a failure costs is the caller's, and the two callers disagree.