mirror of
https://github.com/restic/restic.git
synced 2025-08-21 21:17:27 +00:00
Azure: add option to force use of CLI credential
This commit is contained in:

committed by
Michael Eischer

parent
1dfe1b8732
commit
355f520936
@@ -3,6 +3,7 @@ package azure
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/restic/restic/internal/backend"
|
||||
@@ -13,12 +14,13 @@ import (
|
||||
// Config contains all configuration necessary to connect to an azure compatible
|
||||
// server.
|
||||
type Config struct {
|
||||
AccountName string
|
||||
AccountSAS options.SecretString
|
||||
AccountKey options.SecretString
|
||||
EndpointSuffix string
|
||||
Container string
|
||||
Prefix string
|
||||
AccountName string
|
||||
AccountSAS options.SecretString
|
||||
AccountKey options.SecretString
|
||||
ForceCliCredential bool
|
||||
EndpointSuffix string
|
||||
Container string
|
||||
Prefix string
|
||||
|
||||
Connections uint `option:"connections" help:"set a limit for the number of concurrent connections (default: 5)"`
|
||||
}
|
||||
@@ -73,6 +75,11 @@ func (cfg *Config) ApplyEnvironment(prefix string) {
|
||||
cfg.AccountSAS = options.NewSecretString(os.Getenv(prefix + "AZURE_ACCOUNT_SAS"))
|
||||
}
|
||||
|
||||
var forceCliCred, err = strconv.ParseBool(os.Getenv(prefix + "AZURE_FORCE_CLI_CREDENTIAL"))
|
||||
if err == nil {
|
||||
cfg.ForceCliCredential = forceCliCred
|
||||
}
|
||||
|
||||
if cfg.EndpointSuffix == "" {
|
||||
cfg.EndpointSuffix = os.Getenv(prefix + "AZURE_ENDPOINT_SUFFIX")
|
||||
}
|
||||
|
Reference in New Issue
Block a user