mirror of
https://github.com/restic/restic.git
synced 2026-10-18 15:38:12 +00:00
b2/s3: Move config validation from ApplyEnvironment to Open/Create
Conceptually the backend configuration should be validated when creating or opening the backend, but not when filling in information from environment variables into the configuration.
This commit is contained in:
1 parent
19ac12d95b
commit
3a3cf608f5
12 files changed
+23
-45
No files matched your search
@@ -77,7 +77,7 @@ func ParseConfig(s string) (*Config, error) {
|
||||
var _ restic.ApplyEnvironmenter = &Config{}
|
||||
|
||||
// ApplyEnvironment saves values from the environment to the config.
|
||||
func (cfg *Config) ApplyEnvironment(prefix string) error {
|
||||
func (cfg *Config) ApplyEnvironment(prefix string) {
|
||||
for _, val := range []struct {
|
||||
s *string
|
||||
env string
|
||||
@@ -130,5 +130,4 @@ func (cfg *Config) ApplyEnvironment(prefix string) error {
|
||||
*val.s = options.NewSecretString(os.Getenv(val.env))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -48,9 +48,7 @@ func newSwiftTestSuite(t testing.TB) *test.Suite[swift.Config] {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err = cfg.ApplyEnvironment("RESTIC_TEST_"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cfg.ApplyEnvironment("RESTIC_TEST_")
|
||||
cfg.Prefix += fmt.Sprintf("/test-%d", time.Now().UnixNano())
|
||||
t.Logf("using prefix %v", cfg.Prefix)
|
||||
return cfg, nil
|
||||
|
||||
Reference in new issue
Block a user