mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 02:57:59 +00:00
Add additional config keys for swift (#4901)
* Add additional config keys for swift * Add additional swift config keys in the doc page
This commit is contained in:
committed by
Brian Kassouf
parent
ff8becca15
commit
cf587cf525
@@ -85,6 +85,27 @@ func NewSwiftBackend(conf map[string]string, logger log.Logger) (physical.Backen
|
||||
projectDomain = conf["project-domain"]
|
||||
}
|
||||
|
||||
region := os.Getenv("OS_REGION_NAME")
|
||||
if region == "" {
|
||||
region = conf["region"]
|
||||
}
|
||||
tenantID := os.Getenv("OS_TENANT_ID")
|
||||
if tenantID == "" {
|
||||
tenantID = conf["tenant_id"]
|
||||
}
|
||||
trustID := os.Getenv("OS_TRUST_ID")
|
||||
if trustID == "" {
|
||||
trustID = conf["trust_id"]
|
||||
}
|
||||
storageUrl := os.Getenv("OS_STORAGE_URL")
|
||||
if storageUrl == "" {
|
||||
storageUrl = conf["storage_url"]
|
||||
}
|
||||
authToken := os.Getenv("OS_AUTH_TOKEN")
|
||||
if authToken == "" {
|
||||
authToken = conf["auth_token"]
|
||||
}
|
||||
|
||||
c := swift.Connection{
|
||||
Domain: domain,
|
||||
UserName: username,
|
||||
@@ -92,6 +113,11 @@ func NewSwiftBackend(conf map[string]string, logger log.Logger) (physical.Backen
|
||||
AuthUrl: authUrl,
|
||||
Tenant: project,
|
||||
TenantDomain: projectDomain,
|
||||
Region: region,
|
||||
TenantId: tenantID,
|
||||
TrustId: trustID,
|
||||
StorageUrl: storageUrl,
|
||||
AuthToken: authToken,
|
||||
Transport: cleanhttp.DefaultPooledTransport(),
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@ func TestSwiftBackend(t *testing.T) {
|
||||
project := os.Getenv("OS_PROJECT_NAME")
|
||||
domain := os.Getenv("OS_USER_DOMAIN_NAME")
|
||||
projectDomain := os.Getenv("OS_PROJECT_DOMAIN_NAME")
|
||||
region := os.Getenv("OS_REGION_NAME")
|
||||
tenantID := os.Getenv("OS_TENANT_ID")
|
||||
|
||||
ts := time.Now().UnixNano()
|
||||
container := fmt.Sprintf("vault-test-%d", ts)
|
||||
@@ -36,6 +38,8 @@ func TestSwiftBackend(t *testing.T) {
|
||||
AuthUrl: authUrl,
|
||||
Tenant: project,
|
||||
TenantDomain: projectDomain,
|
||||
Region: region,
|
||||
TenantId: tenantID,
|
||||
Transport: cleanhttp.DefaultPooledTransport(),
|
||||
}
|
||||
|
||||
@@ -75,6 +79,8 @@ func TestSwiftBackend(t *testing.T) {
|
||||
"project": project,
|
||||
"domain": domain,
|
||||
"project-domain": projectDomain,
|
||||
"tenant_id": tenantID,
|
||||
"region": region,
|
||||
}, logger)
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
|
||||
@@ -33,8 +33,7 @@ storage "swift" {
|
||||
## `swift` Parameters
|
||||
|
||||
- `auth_url` `(string: <required>)` – Specifies the OpenStack authentication
|
||||
endpoint. Currently only v1.0 authentication endpoints are supported. This can
|
||||
also be provided via the environment variable `OS_AUTH_URL`.
|
||||
endpoint. This can also be provided via the environment variable `OS_AUTH_URL`.
|
||||
|
||||
- `container` `(string: <required>)` – Specifies the name of the Swift
|
||||
container. This can also be provided via the environment variable
|
||||
@@ -52,6 +51,20 @@ storage "swift" {
|
||||
- `username` `(string: <required>)` – Specifies the OpenStack account/username.
|
||||
This can also be provided via the environment variable `OS_USERNAME`.
|
||||
|
||||
- `region` `(string: "")` – Specifies the name of the region. This can also be provided via the environment variable `OS_REGION_NAME`.
|
||||
|
||||
- `tenant_id` `(string: "")` - Specifies the id of the tenant. This can also be provided via the environment variable `OS_TENANT_ID`.
|
||||
|
||||
- `domain` `(string: "")` - Specifies the name of the user domain. This can also be provided via the environment variable `OS_USER_DOMAIN_NAME`.
|
||||
|
||||
- `project-domain` `(string: "")` - Specifies the name of the project's domain. This can also be provided via the environment variable `OS_PROJECT_DOMAIN_NAME`.
|
||||
|
||||
- `trust_id` `(string: "")` - Specifies the id of the trust. This can also be provided via the environment variable `OS_TRUST_ID`.
|
||||
|
||||
- `storage_url` `(string: "")` - Specifies storage URL from alternate authentication. This can also be provided via the environment variable `OS_STORAGE_URL`.
|
||||
|
||||
- `auth_token` `(string: "")` - Specifies auth token from alternate authentication. This can also be provided via the environment variable `OS_AUTH_TOKEN`.
|
||||
|
||||
## `swift` Examples
|
||||
|
||||
### Default Example
|
||||
|
||||
Reference in New Issue
Block a user