Skip to content

New configuration format

Fred edited this page Oct 19, 2021 · 1 revision

Proposal for an updated configuration file format

Introduction

The current file format was decided at the time resticprofile was only using the toml format. Nesting pieces of configuration in blocks is not the easiest as you have to specify the whole path in the block:

[profile]

[profile.backup]
...

Since then, I believe the yaml format is preferred over toml.

My proposal is to make a version 1 of the configuration file, the current file format is version 0. Both formats will continue to be valid (like docker-compose):

  • if no version is specified, the version 0 is used. This is the current format
  • if a version is specified, 1 being the only one accepted for now, the new format will be expected

New format specifications

I will show the specification using the yaml as examples. I'm not retiring the other formats.

version

---
version: 1

global

The global section does not change. We'll keep all the global configuration in there.

---
global:
    default-command: snapshots
    initialize: false
    priority: low

profiles

All your profiles will be nested under a profiles section. Please note the schedules are no longer described inside the profile, but in a separate section schedules (see following sections).

profiles:
    default:
        env:
            tmp: /tmp
        password-file: key
        repository: /backup

    documents:
        inherit: default
        backup:
            source: ~/Documents
        snapshots:
            tag:
                - documents

groups

The list of profiles will be nested under a profiles section, so we can add more configuration to groups later.

groups:
    full: # name of your group
        profiles:
            - root
            - documents
            - mysql

schedules

A new schedule section could schedule either a group or a list of profiles.

schedules:
    full-backup: # give a name to your schedule
        group: full
        schedule:
            - "Mon..Fri *:00,15,30,45" # every 15 minutes on weekdays
        permission: user
        run: backup # backup is the default if not specified

    other:
        profiles:
            - root
            - mysql
        schedule:
            - "Sat,Sun 0,12:00" # twice a day on week-ends
        permission: user
        run: prune

This format leaves more space for improvements later (like a repos section)

Does that make sense?

Please reply in the opened issue, thanks :)