mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-06 10:21:05 +02:00
parent
05545b3e1d
commit
3039407597
5 changed files with 7 additions and 9 deletions
2
.github/workflows/test.yaml
vendored
2
.github/workflows/test.yaml
vendored
|
@ -148,4 +148,4 @@ jobs:
|
|||
uses: actions/checkout@v2
|
||||
|
||||
- name: test
|
||||
run: go test -v -tags redis ./pkg/storage/redis/...
|
||||
run: go test -v -tags redis ./pkg/storage/redis/... ./internal/databroker/...
|
||||
|
|
|
@ -831,7 +831,7 @@ The backend storage that databroker server will use, available types: `memory`,
|
|||
- Config File Key: `databroker_storage_connection_string`
|
||||
- Type: `string`
|
||||
- **Required** when storage type is `redis`
|
||||
- Example: `":6379"`
|
||||
- Example: `"redis://localhost:6379/0"`
|
||||
|
||||
The connection string that server will use to connect to storage backend.
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
)
|
||||
|
||||
func newTestServer() *Server {
|
||||
address := ":6379"
|
||||
address := "redis://localhost:6379/0"
|
||||
if redisURL := os.Getenv("REDIS_URL"); redisURL != "" {
|
||||
address = redisURL
|
||||
}
|
||||
|
|
|
@ -35,14 +35,12 @@ type DB struct {
|
|||
}
|
||||
|
||||
// New returns new DB instance.
|
||||
func New(address, recordType string, deletePermanentAfter int64) (*DB, error) {
|
||||
func New(rawURL, recordType string, deletePermanentAfter int64) (*DB, error) {
|
||||
db := &DB{
|
||||
pool: &redis.Pool{
|
||||
Wait: true,
|
||||
DialContext: func(ctx context.Context) (redis.Conn, error) {
|
||||
ctx, cancelFn := context.WithTimeout(ctx, 5*time.Second)
|
||||
defer cancelFn()
|
||||
c, err := redis.DialContext(ctx, "tcp", address)
|
||||
Dial: func() (redis.Conn, error) {
|
||||
c, err := redis.DialURL(rawURL)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf(`redis.DialURL(): %w`, err)
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ func cleanup(c redis.Conn, db *DB, t *testing.T) {
|
|||
func TestDB(t *testing.T) {
|
||||
ctx, cancelFunc := context.WithCancel(context.Background())
|
||||
defer cancelFunc()
|
||||
address := ":6379"
|
||||
address := "redis://localhost:6379/0"
|
||||
if redisURL := os.Getenv("REDIS_URL"); redisURL != "" {
|
||||
address = redisURL
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue