Skip to content

Commit 90be19f

Browse files
committed
add redis username
1 parent bd68356 commit 90be19f

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

.github/workflows/srv.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ jobs:
9292
Environment=DATABASE_URL=${{ secrets.DATABASE_URL }}
9393
9494
Environment=REDIS_ADDR=${{ secrets.REDIS_ADDR }}
95+
Environment=REDIS_USER=${{ secrets.REDIS_USER }}
9596
Environment=REDIS_PASS=${{ secrets.REDIS_PASS }}
9697
97-
9898
Environment=SUPABASE_JWT_SECRET=${{ secrets.SUPABASE_JWT_SECRET }}
9999
Environment=RESEND_API_KEY=${{ secrets.RESEND_API_KEY }}
100100
@@ -103,7 +103,6 @@ jobs:
103103
Environment=CF_ACCOUNT_ID=${{ secrets.CF_ACCOUNT_ID }}
104104
Environment=R2_ACCESS_KEY_ID=${{ secrets.R2_ACCESS_KEY_ID }}
105105
Environment=R2_ACCESS_SECRET_KEY=${{ secrets.R2_ACCESS_SECRET_KEY }}
106-
107106
108107
Restart=on-failure
109108
RestartSec=5

backend/cmd/srv/main.go

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ func run(ctx context.Context) error {
5353

5454
rdb := redis.NewClient(&redis.Options{
5555
Addr: zyg.RedisAddr(),
56+
Username: zyg.RedisUsername(),
5657
Password: zyg.RedisPassword(),
5758
DB: 0,
5859
})

backend/cmd/xsrv/main.go

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ func run(ctx context.Context) error {
5353

5454
rdb := redis.NewClient(&redis.Options{
5555
Addr: zyg.RedisAddr(),
56+
Username: zyg.RedisUsername(),
5657
Password: zyg.RedisPassword(),
5758
DB: 0,
5859
})

backend/config.go

+8
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@ func RedisAddr() string {
9696
return value
9797
}
9898

99+
func RedisUsername() string {
100+
value, ok := os.LookupEnv("REDIS_USER")
101+
if !ok {
102+
return "zygdev"
103+
}
104+
return value
105+
}
106+
99107
func RedisPassword() string {
100108
value, ok := os.LookupEnv("REDIS_PASS")
101109
if !ok {

0 commit comments

Comments
 (0)