backend: let ParseConfig return a Config pointer
In order to change the backend initialization in `global.go` to be able to generically call cfg.ApplyEnvironment() for supported backends, the `interface{}` returned by `ParseConfig` must contain a pointer to the configuration. An alternative would be to use reflection to convert the type from `interface{}(Config)` to `interface{}(*Config)` (from value to pointer type). However, this would just complicate the type mess further.
This commit is contained in:
parent
25a0be7f26
commit
f903db492c
26 changed files with 165 additions and 146 deletions
18
internal/backend/local/config_test.go
Normal file
18
internal/backend/local/config_test.go
Normal file
|
@ -0,0 +1,18 @@
|
|||
package local
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/restic/restic/internal/backend/test"
|
||||
)
|
||||
|
||||
var configTests = []test.ConfigTestData[Config]{
|
||||
{S: "local:/some/path", Cfg: Config{
|
||||
Path: "/some/path",
|
||||
Connections: 2,
|
||||
}},
|
||||
}
|
||||
|
||||
func TestParseConfig(t *testing.T) {
|
||||
test.ParseConfigTester(t, ParseConfig, configTests)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue