in component/azstorage/config.go [565:634]
func ParseAndReadDynamicConfig(az *AzStorage, opt AzStorageOptions, reload bool) error {
log.Trace("ParseAndReadDynamicConfig : Reparsing config")
// If block size and max concurrency is configured use those
// A user provided value of 0 doesn't make sense for BlockSize, or MaxConcurrency.
if opt.BlockSize != 0 {
az.stConfig.blockSize = opt.BlockSize * 1024 * 1024
}
if opt.MaxConcurrency != 0 {
az.stConfig.maxConcurrency = opt.MaxConcurrency
}
// Populate default tier
if opt.DefaultTier != "" {
az.stConfig.defaultTier = getAccessTierType(opt.DefaultTier)
}
az.stConfig.ignoreAccessModifiers = !opt.FailUnsupportedOp
az.stConfig.validateMD5 = opt.ValidateMD5
az.stConfig.updateMD5 = opt.UpdateMD5
if config.IsSet(compName + ".virtual-directory") {
az.stConfig.virtualDirectory = opt.VirtualDirectory
} else {
az.stConfig.virtualDirectory = true
}
if config.IsSet(compName+".max-results-for-list") && opt.MaxResultsForList > 0 {
az.stConfig.maxResultsForList = opt.MaxResultsForList
} else {
az.stConfig.maxResultsForList = DefaultMaxResultsForList
}
if config.IsSet(compName + ".disable-compression") {
az.stConfig.disableCompression = opt.DisableCompression
} else {
az.stConfig.disableCompression = DisableCompression
}
if config.IsSet(compName + ".honour-acl") {
az.stConfig.honourACL = opt.HonourACL
} else {
az.stConfig.honourACL = false
}
// Auth related reconfig
switch opt.AuthMode {
case "sas":
az.stConfig.authConfig.AuthMode = EAuthType.SAS()
if opt.SaSKey == "" {
return errors.New("SAS key not provided")
}
oldSas := az.stConfig.authConfig.SASKey
az.stConfig.authConfig.SASKey = sanitizeSASKey(opt.SaSKey)
if reload {
log.Info("ParseAndReadDynamicConfig : SAS Key updated")
if err := az.storage.UpdateServiceClient("saskey", az.stConfig.authConfig.SASKey); err != nil {
az.stConfig.authConfig.SASKey = oldSas
_ = az.storage.UpdateServiceClient("saskey", az.stConfig.authConfig.SASKey)
return errors.New("SAS key update failure")
}
}
}
return nil
}