featurer/docs/DATA_STORE.md

51 lines
1.5 KiB
Markdown
Raw Permalink Normal View History

2024-10-14 01:14:28 +05:00
# 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
}
}
}
}
```