Default Configs
Default Configs is the set of all possible configuration keys of your application along with their default values. One may think of default configs as the best assumption we can make about our configs.
Every default config is defined by two properties:
- Schema - the type of the config value enforced by JSONSchema
- Default value - the base value for the config key
Let us use a simple cab ride-hailing application that operates in different cities and capture some attributes that we might need configurable at a per city level.
per_distance_unit_ratesurge_factor
CAC supports configurations written using the TOML format. This section and the following sections will use the TOML format to illustrate each abstraction.
[default-configs]
per_km_rate = { "value" = 20.0, "schema" = { "type" = "number" } }
surge_factor = { "value" = 0.0, "schema" = { "type" = "number" } }
Correctness with Functions
Two functions that can be linked with default configs to ensure correctness:
- Value Validation
- Value Compute
To learn more about these, check out functions