Datastore version one.
All checks were successful
Linting and tests / Tests (push) Successful in 59s
Linting and tests / Linting (push) Successful in 1m12s

Closes #2
This commit is contained in:
2024-10-14 01:14:28 +05:00
parent bbb9824ad1
commit a901ba49e5
11 changed files with 571 additions and 9 deletions

50
docs/DATA_STORE.md Normal file
View File

@@ -0,0 +1,50 @@
# Data storage
As of v0 (and probably v1) data storage implemented to be in plain text files. These files will be loaded into memory on startup and will be modified on request (e.g. when new flag is created). This is simplest approach for storing data.
Some limitations arises:
- Hard to implement application clustering (yet solvable).
- No reasonable security measures can be taken to ensure there will be no data loss. Do backups, please!
Until any of above lines aren't removed - limitation applies.
## Configuring data storage
Data storage can be configured via environment variables.
| Key | Format | Description |
| --- | --- | --- |
| `FEATURER_DATA_STORAGE_PATH` | | Path to root directory where Featurer data will reside. |
## Data storage structure
As Featurer is about applications, data storage was built around them.
Every application have own file with all environment and settings defined in it. These files contains JSON payload, so it is easy to save and load them, as well as backup.
Typical structure is:
```json
{
"version": "1",
"last_modified": "RFC3339 timestamp",
"data": {}
}
```
When other parts of Featurer asks to save value for some key, e.g. `production/feature_name/enabled`, it will be something like that when saved:
```json
{
"version": "1",
"last_modified": "2024-10-13T11:32:12.618218865Z",
"data": {
"production": {
"feature_name": {
"enabled": true
}
}
}
}
```

View File

@@ -5,6 +5,7 @@ Welcome to Featurer's documentation!
## Administrator's corner
- [Configuring HTTP servers](HTTP.md)
- [Configuring data storage](DATA_STORE.md)
## Users documentation