@@ -1,18 +1,19 @@
|
||||
# ADR 002: Choose a good configuration file format.
|
||||
# ADR 002: Choose a good configuration format.
|
||||
|
||||
A good configuration file format needs to be selected. There are three main choices that were considered:
|
||||
|
||||
1. JSON - this is the primary data format used for the web and communications, but is not as readable as the other options.
|
||||
2. YAML - this is a much more readable format, and is a superset of JSON (able to load JSON as YAML), however there are weird nuances in this format that can cause problems.
|
||||
3. TOML - this is a format similar to the old Windows Config format, but with better structuring. It is readable, and clear like YAML, but without the weird corner cases that YAML has which could break things. However support is small as it is relatively new.
|
||||
4. SQL DB Table - this would be using the database system to store what would have been put in a configuration file and making it instead be a configuration table.
|
||||
|
||||
## Decision
|
||||
|
||||
TOML was decided to be used for the configuration file. The `toml` library is chosen to handle this format.
|
||||
SQL DB Table
|
||||
|
||||
## Rationale
|
||||
|
||||
TOML is very readable, does not have the bizarre error problems that YAML does, and is an up-and-coming technology. While the support is relatively light right now, it already is showing up in the standard Python libraries, as well as a handful of other libraries.
|
||||
Because the system already is using an SQL Database, it makes sense to use a SQL table to store these values in a simple way that then can be retrieved and updated using the same basic SQL components other parts of the application use.
|
||||
|
||||
## Status
|
||||
|
||||
@@ -20,4 +21,4 @@ Accepted
|
||||
|
||||
## Consequences
|
||||
|
||||
Using the `toml` library means accepting a relatively new library with a version 0.10, which could have issues until it matures to a full system. Might need to revisit and pick another library for the config files if the `toml` library doesn't work.
|
||||
Setting up the database already was necessary for the application, this would simply require it to be set up sooner.
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
# ADR 003: Choose location of configuration and other files
|
||||
|
||||
It is important to store files in a way that is appropriate for whatever platform the application is running on, as such there is a library that can handle this correctly and efficiently. Two different libraries were reviewed:
|
||||
|
||||
1. `appdirs` - sets up directories which can be written to easily, in a synchronous manner.
|
||||
2. `app-paths` - does what `appdirs` does, but with `Path` objects (or `AsyncPath`), and allows for async file operations.
|
||||
|
||||
## Decision
|
||||
|
||||
`app-paths` was chosen.
|
||||
|
||||
## Rationale
|
||||
|
||||
Using the library `app-paths` allows for the different paths needed for configuration, logs, etc to be defined in such a way as to be platform-agnostic, and will automatically make the paths be put in an appropriate location for the system that the application is running on. The fact that it allows for files to be operated on asynchronously and using an AsyncPath object makes it an obvious choice for this application.
|
||||
|
||||
## Status
|
||||
|
||||
Accepted
|
||||
|
||||
## Consequences
|
||||
|
||||
Not exactly certain what concequences there will be with this choice. It seems the better choice all around. `app-paths` also is only at a version 0.0, which does not give much confidence in the library, and hopes are it will mature quickly over time. However it is built on top of `appdirs` and `aiopath` both of which are more mature.
|
||||
Reference in New Issue
Block a user