forked from TrueCloudLab/restic
Merge pull request #3470 from MichaelEischer/sanitize-debug-log
Sanitize debug log
This commit is contained in:
commit
c16f989d4a
16 changed files with 199 additions and 32 deletions
|
@ -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,
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue