Kozai::Settings::Store
The settings written from the interface, and the file holding them.
Constructors
Reads the file, or an empty store if there is none.
A file that cannot be parsed is reported and ignored rather than fatal: this file is written by the program, so a broken one means something else damaged it, and refusing to start over it would leave the operator with no interface to fix it from.
Instance methods
Applies these values on top of config.
NOTE: what was overwritten is noted here, before the write, and not
asked for afterwards. The origin of a setting is whatever set it last,
so once this has run every one of them reads <settings page> and the
environment variable underneath is gone. Reconstructing it later is not
possible; recording it now is one line.
A copy of this store with changes applied, for trying before buying.
Whether a configuration is usable cannot be decided field by field: a transponder path is a valid string and a missing file, a latitude is a valid number and the geometry may still refuse it. So the candidate is built here, everything is constructed from it, and only a candidate that survives that is written.
Writes the file.
NOTE: written through a temporary and renamed, the same way the element cache is. A station losing power mid-write should come back with the old settings rather than with half a file it cannot parse โ and this file is how the operator would fix that, so it is the worst one to lose.
Sets a value, after checking it.
NOTE: empty is handled before validation, not after. An empty field means "stop overriding this", putting the configuration file and the environment back in charge. Validating first instead refuses the whole save with "Altitude must be a number" โ for a field the operator never filled in and never meant to, on a form that submits all of them. That is not a hypothetical: it is what the page did the first time it was used.
Settings here that cover an environment variable.
NOTE: this is what keeps the arrangement honest. A value written from
the interface outranks docker-compose.yml, which is what makes the
page usable on a station configured entirely through the environment โ
and would otherwise leave somebody editing a compose file that does
nothing. Reported on the way up and through the API, never inferred.