Skip to content
Snippets Groups Projects
Commit 6a6cfa4e authored by Radoslav Bodó's avatar Radoslav Bodó
Browse files

general: config reference documentation

parent f5c1283d
No related branches found
No related tags found
No related merge requests found
Pipeline #7684 failed
...@@ -60,12 +60,16 @@ somewhere - if I only knew.* ...@@ -60,12 +60,16 @@ somewhere - if I only knew.*
## Usage ## Usage
### Install ### Install
``` ```
git clone https://gitlab.cesnet.cz/radoslav_bodo/rwm.git /opt/rwm git clone https://gitlab.cesnet.cz/radoslav_bodo/rwm.git /opt/rwm
cd /opt/rwm cd /opt/rwm
make install make install
``` ```
Configuration file uses YAML format, see `examples/` for basic use-cases or
`rwm.RWMConfig` autodoc for full reference.
### RWM: simple backups ### RWM: simple backups
......
...@@ -68,20 +68,32 @@ def size_fmt(num): ...@@ -68,20 +68,32 @@ def size_fmt(num):
return f'{num:0.1f} YiB' return f'{num:0.1f} YiB'
class BackupConfig(BaseModel): class RWMConfig(BaseModel):
"""backup config model""" """Main configuration for RWM. Configuration file format is YAML.
model_config = ConfigDict(extra='forbid') Attributes:
s3_endpoint_url:
REQUIRED. The endpoint URL for S3.
filesdirs: List[str] s3_access_key:
excludes: Optional[List[str]] = [] REQUIRED. Access key for S3.
extras: Optional[List[str]] = []
prerun: Optional[List[str]] = []
postrun: Optional[List[str]] = []
s3_secret_key:
REQUIRED. Secret key for S3.
class RWMConfig(BaseModel): restic_bucket:
"""main config model""" Bucket for Restic backup repository.
restic_password:
Password for Restic backup repository.
backups:
Dictionary containing named backup configurations.
retention:
Dictionary containing retention policies for Restic repository.
Keys and values corresponds to a `restic forget` command `--keep*` options without leading dashes.
"""
model_config = ConfigDict(extra='forbid') model_config = ConfigDict(extra='forbid')
...@@ -94,6 +106,35 @@ class RWMConfig(BaseModel): ...@@ -94,6 +106,35 @@ class RWMConfig(BaseModel):
retention: Dict[str, str] = {} retention: Dict[str, str] = {}
class BackupConfig(BaseModel):
"""Configuration for backup operations.
Attributes:
filesdirs:
REQUIRED. List of files and directories to be backed up.
excludes:
List of patterns for `--exclude` options for `restic backup` commmand. Defaults to an empty list.
extras:
Additional options for the `restic backup` commmand. Defaults to an empty list.
prerun:
List of shell commands to execute before backup. Defaults to an empty list.
postrun:
List of shell commands to execute after backup. Defaults to an empty list.
"""
model_config = ConfigDict(extra='forbid')
filesdirs: List[str]
excludes: List[str] = []
extras: List[str] = []
prerun: List[str] = []
postrun: List[str] = []
class RwmJSONEncoder(json.JSONEncoder): class RwmJSONEncoder(json.JSONEncoder):
"""json encoder""" """json encoder"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment