forked from TrueCloudLab/restic
wip
This commit is contained in:
parent
740e2d6139
commit
1fbcf63830
1 changed files with 8 additions and 7 deletions
|
@ -15,11 +15,12 @@ import (
|
||||||
|
|
||||||
// Config contains configuration items read from a file.
|
// Config contains configuration items read from a file.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Repo string `hcl:"repo" flag:"repo" env:"RESTIC_REPOSITORY"`
|
Repo string `config:"repo" flag:"repo" env:"RESTIC_REPOSITORY"`
|
||||||
Password string `hcl:"password" env:"RESTIC_PASSWORD"`
|
Password string `config:"password" env:"RESTIC_PASSWORD"`
|
||||||
|
PasswordFile string `config:`
|
||||||
|
|
||||||
Backends map[string]Backend `hcl:"backend"`
|
Backends map[string]Backend `config:"backend"`
|
||||||
Backup *Backup `hcl:"backup"`
|
Backup *Backup `config:"backup"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Backend is a configured backend to store a repository.
|
// Backend is a configured backend to store a repository.
|
||||||
|
@ -30,7 +31,7 @@ type Backend struct {
|
||||||
|
|
||||||
// Backup sets the options for the "backup" command.
|
// Backup sets the options for the "backup" command.
|
||||||
type Backup struct {
|
type Backup struct {
|
||||||
Target []string `hcl:"target"`
|
Target []string `config:"target"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// listTags returns the all the top-level tags with the name tagname of obj.
|
// listTags returns the all the top-level tags with the name tagname of obj.
|
||||||
|
@ -78,8 +79,8 @@ func Parse(buf []byte) (cfg Config, err error) {
|
||||||
root := parsed.Node.(*ast.ObjectList)
|
root := parsed.Node.(*ast.ObjectList)
|
||||||
|
|
||||||
checks := map[string]map[string]struct{}{
|
checks := map[string]map[string]struct{}{
|
||||||
"": listTags(cfg, "hcl"),
|
"": listTags(cfg, "config"),
|
||||||
"backup": listTags(Backup{}, "hcl"),
|
"backup": listTags(Backup{}, "config"),
|
||||||
}
|
}
|
||||||
|
|
||||||
for name, valid := range checks {
|
for name, valid := range checks {
|
||||||
|
|
Loading…
Reference in a new issue