mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-09 23:27:43 +02:00
databroker server backend config (#1127)
* config,docs: add databroker storage backend configuration * cache: allow configuring which backend storage to use Currently supported types are "memory", "redis".
This commit is contained in:
parent
c9182f757e
commit
1640151bc1
9 changed files with 99 additions and 6 deletions
|
@ -40,6 +40,10 @@ func Test_Validate(t *testing.T) {
|
|||
|
||||
badPolicyFile := testOptions()
|
||||
badPolicyFile.PolicyFile = "file"
|
||||
invalidStorageType := testOptions()
|
||||
invalidStorageType.DataBrokerStorageType = "foo"
|
||||
missingStorageDSN := testOptions()
|
||||
missingStorageDSN.DataBrokerStorageType = "redis"
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
|
@ -51,6 +55,8 @@ func Test_Validate(t *testing.T) {
|
|||
{"missing shared secret", badSecret, true},
|
||||
{"missing shared secret but all service", badSecretAllServices, false},
|
||||
{"policy file specified", badPolicyFile, true},
|
||||
{"invalid databroker storage type", invalidStorageType, true},
|
||||
{"missing databroker storage dsn", missingStorageDSN, true},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
@ -236,6 +242,7 @@ func TestOptionsFromViper(t *testing.T) {
|
|||
},
|
||||
RefreshDirectoryTimeout: 1 * time.Minute,
|
||||
RefreshDirectoryInterval: 10 * time.Minute,
|
||||
DataBrokerStorageType: "memory",
|
||||
},
|
||||
false},
|
||||
{"good disable header",
|
||||
|
@ -252,6 +259,7 @@ func TestOptionsFromViper(t *testing.T) {
|
|||
Headers: map[string]string{},
|
||||
RefreshDirectoryTimeout: 1 * time.Minute,
|
||||
RefreshDirectoryInterval: 10 * time.Minute,
|
||||
DataBrokerStorageType: "memory",
|
||||
},
|
||||
false},
|
||||
{"bad url", []byte(`{"policy":[{"from": "https://","to":"https://to.example"}]}`), nil, true},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue