Initial cloud-services repo - gateway service + pkg modules

This commit is contained in:
Chris Rai
2026-01-30 23:14:52 -05:00
commit fbb820d7b3
1037 changed files with 171318 additions and 0 deletions

29
pkg/redisv2/connection.go Normal file
View File

@@ -0,0 +1,29 @@
package redisv2
import (
"fmt"
"fiskerinc.com/modules/utils/envtool"
"github.com/redis/go-redis/v9"
)
// connection vars
var ()
// Actual connection to the redis
func NewConnection() (redisClient *redis.Client) {
host := envtool.GetEnv("REDIS_HOST", "localhost")
port := envtool.GetEnv("REDIS_PORT", "6379")
username := envtool.GetEnv("REDIS_USERNAME", "default")
password := envtool.GetEnv("REDIS_PASSWORD", "REPLACE_ME")
addr := fmt.Sprintf("%v:%v", host, port)
rdb := redis.NewClient(&redis.Options{
Addr: addr,
Username: username,
Password: password,
MaxActiveConns: envtool.GetEnvInt("REDIS_MAXACTIVECONN", 10),
PoolSize: envtool.GetEnvInt("REDIS_POOLSIZE", 10),
})
return rdb
}