Skip to content

Commit

Permalink
add redis username
Browse files Browse the repository at this point in the history
  • Loading branch information
sanchitrk committed Dec 8, 2024
1 parent bd68356 commit 90be19f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/srv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ jobs:
Environment=DATABASE_URL=${{ secrets.DATABASE_URL }}
Environment=REDIS_ADDR=${{ secrets.REDIS_ADDR }}
Environment=REDIS_USER=${{ secrets.REDIS_USER }}
Environment=REDIS_PASS=${{ secrets.REDIS_PASS }}
Environment=SUPABASE_JWT_SECRET=${{ secrets.SUPABASE_JWT_SECRET }}
Environment=RESEND_API_KEY=${{ secrets.RESEND_API_KEY }}
Expand All @@ -103,7 +103,6 @@ jobs:
Environment=CF_ACCOUNT_ID=${{ secrets.CF_ACCOUNT_ID }}
Environment=R2_ACCESS_KEY_ID=${{ secrets.R2_ACCESS_KEY_ID }}
Environment=R2_ACCESS_SECRET_KEY=${{ secrets.R2_ACCESS_SECRET_KEY }}
Restart=on-failure
RestartSec=5
Expand Down
1 change: 1 addition & 0 deletions backend/cmd/srv/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func run(ctx context.Context) error {

rdb := redis.NewClient(&redis.Options{
Addr: zyg.RedisAddr(),
Username: zyg.RedisUsername(),
Password: zyg.RedisPassword(),
DB: 0,
})
Expand Down
1 change: 1 addition & 0 deletions backend/cmd/xsrv/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func run(ctx context.Context) error {

rdb := redis.NewClient(&redis.Options{
Addr: zyg.RedisAddr(),
Username: zyg.RedisUsername(),
Password: zyg.RedisPassword(),
DB: 0,
})
Expand Down
8 changes: 8 additions & 0 deletions backend/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ func RedisAddr() string {
return value
}

func RedisUsername() string {
value, ok := os.LookupEnv("REDIS_USER")
if !ok {
return "zygdev"
}
return value
}

func RedisPassword() string {
value, ok := os.LookupEnv("REDIS_PASS")
if !ok {
Expand Down

0 comments on commit 90be19f

Please sign in to comment.