Move init to 'config init', add config edit/get/set subcommands
The config command group manages the config file: config init - write default config (moved from top-level init) config edit - open the config in $EDITOR (falls back to vi) config get - print a value by dotted YAML path (s3.bucket) config set - set a scalar value by dotted YAML path get/set operate on the yaml.Node tree so comments and formatting in the config file are preserved across edits. set creates intermediate maps as needed.
This commit is contained in:
25
README.md
25
README.md
@@ -55,14 +55,17 @@ age-keygen -o key.txt
|
||||
# the public key is printed to stdout and also in key.txt
|
||||
|
||||
# 3. Create a default config file
|
||||
vaultik init
|
||||
vaultik config init
|
||||
# Writes to the platform config directory with commented defaults:
|
||||
# macOS: ~/Library/Application Support/vaultik/config.yml
|
||||
# Linux: ~/.config/vaultik/config.yml
|
||||
# root: /etc/vaultik/config.yml
|
||||
|
||||
# 4. Edit the config: set age_recipients, snapshots, and storage_url
|
||||
# (init prints the path it wrote to)
|
||||
vaultik config edit # opens $EDITOR
|
||||
# or set individual values:
|
||||
vaultik config set storage_url "file:///mnt/backups"
|
||||
vaultik config get storage_url
|
||||
|
||||
# 5. Run your first backup
|
||||
vaultik snapshot create
|
||||
@@ -82,7 +85,10 @@ vaultik snapshot verify <snapshot-id>
|
||||
### commands
|
||||
|
||||
```sh
|
||||
vaultik [--config <path>] init
|
||||
vaultik [--config <path>] config init
|
||||
vaultik [--config <path>] config edit
|
||||
vaultik [--config <path>] config get <key>
|
||||
vaultik [--config <path>] config set <key> <value>
|
||||
vaultik [--config <path>] snapshot create [snapshot-names...] [--cron] [--prune] [--keep-newer-than <duration>] [--skip-errors]
|
||||
vaultik [--config <path>] snapshot list [--json]
|
||||
vaultik [--config <path>] snapshot verify <snapshot-id> [--deep] [--json]
|
||||
@@ -114,12 +120,21 @@ vaultik version
|
||||
|
||||
### command details
|
||||
|
||||
**init**: Write a default config file with commented explanations for every
|
||||
setting. Writes to the path from `--config`, `$VAULTIK_CONFIG`, or the
|
||||
**config init**: Write a default config file with commented explanations for
|
||||
every setting. Writes to the path from `--config`, `$VAULTIK_CONFIG`, or the
|
||||
platform config directory (`~/Library/Application Support/vaultik/` on macOS,
|
||||
`~/.config/vaultik/` on Linux, `/etc/vaultik/` as root). Refuses to overwrite an
|
||||
existing file. Created with mode `0600` since it will contain credentials.
|
||||
|
||||
**config edit**: Open the config file in `$EDITOR` (falls back to `vi`).
|
||||
|
||||
**config get**: Print a config value addressed by dotted YAML path
|
||||
(e.g. `vaultik config get s3.bucket`). Non-scalar values print as YAML.
|
||||
|
||||
**config set**: Set a scalar config value by dotted YAML path
|
||||
(e.g. `vaultik config set compression_level 9`). Comments and formatting
|
||||
in the file are preserved; intermediate maps are created as needed.
|
||||
|
||||
**snapshot create**: Perform incremental backup of configured snapshots.
|
||||
* Optional snapshot names argument to create specific snapshots (default: all)
|
||||
* `--cron`: Silent unless error (for crontab)
|
||||
|
||||
Reference in New Issue
Block a user