mirror of
https://github.com/restic/restic.git
synced 2025-10-09 10:44:38 +00:00
Merge pull request #3470 from MichaelEischer/sanitize-debug-log
Sanitize debug log
This commit is contained in:
@@ -24,12 +24,12 @@ type Config struct {
|
||||
TrustID string
|
||||
|
||||
StorageURL string
|
||||
AuthToken string
|
||||
AuthToken options.SecretString
|
||||
|
||||
// auth v3 only
|
||||
ApplicationCredentialID string
|
||||
ApplicationCredentialName string
|
||||
ApplicationCredentialSecret string
|
||||
ApplicationCredentialSecret options.SecretString
|
||||
|
||||
Container string
|
||||
Prefix string
|
||||
@@ -111,11 +111,9 @@ func ApplyEnvironment(prefix string, cfg interface{}) error {
|
||||
// Application Credential auth
|
||||
{&c.ApplicationCredentialID, prefix + "OS_APPLICATION_CREDENTIAL_ID"},
|
||||
{&c.ApplicationCredentialName, prefix + "OS_APPLICATION_CREDENTIAL_NAME"},
|
||||
{&c.ApplicationCredentialSecret, prefix + "OS_APPLICATION_CREDENTIAL_SECRET"},
|
||||
|
||||
// Manual authentication
|
||||
{&c.StorageURL, prefix + "OS_STORAGE_URL"},
|
||||
{&c.AuthToken, prefix + "OS_AUTH_TOKEN"},
|
||||
|
||||
{&c.DefaultContainerPolicy, prefix + "SWIFT_DEFAULT_CONTAINER_POLICY"},
|
||||
} {
|
||||
@@ -123,5 +121,16 @@ func ApplyEnvironment(prefix string, cfg interface{}) error {
|
||||
*val.s = os.Getenv(val.env)
|
||||
}
|
||||
}
|
||||
for _, val := range []struct {
|
||||
s *options.SecretString
|
||||
env string
|
||||
}{
|
||||
{&c.ApplicationCredentialSecret, prefix + "OS_APPLICATION_CREDENTIAL_SECRET"},
|
||||
{&c.AuthToken, prefix + "OS_AUTH_TOKEN"},
|
||||
} {
|
||||
if val.s.String() == "" {
|
||||
*val.s = options.NewSecretString(os.Getenv(val.env))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@@ -61,10 +61,10 @@ func Open(ctx context.Context, cfg Config, rt http.RoundTripper) (restic.Backend
|
||||
TenantDomainId: cfg.TenantDomainID,
|
||||
TrustId: cfg.TrustID,
|
||||
StorageUrl: cfg.StorageURL,
|
||||
AuthToken: cfg.AuthToken,
|
||||
AuthToken: cfg.AuthToken.Unwrap(),
|
||||
ApplicationCredentialId: cfg.ApplicationCredentialID,
|
||||
ApplicationCredentialName: cfg.ApplicationCredentialName,
|
||||
ApplicationCredentialSecret: cfg.ApplicationCredentialSecret,
|
||||
ApplicationCredentialSecret: cfg.ApplicationCredentialSecret.Unwrap(),
|
||||
ConnectTimeout: time.Minute,
|
||||
Timeout: time.Minute,
|
||||
|
||||
|
Reference in New Issue
Block a user