fix: pick up redisPort param

This commit is contained in:
efim 2023-11-26 03:48:36 +00:00
parent 97544ab816
commit 1a567c6e12
1 changed files with 2 additions and 2 deletions

View File

@ -19,9 +19,9 @@ var ctx = context.Background()
func main() {
var port int
flag.IntVar(&port, "port", 8080, "Port on which the server should start")
flag.Parse()
var redisPort int
flag.IntVar(&redisPort, "redisPort", 7777, "Port on which server should connect to redis db")
flag.Parse()
rdb := redis.NewClient(&redis.Options{
Addr: fmt.Sprintf("localhost:%d", redisPort),
@ -32,7 +32,7 @@ func main() {
roomsM := rooms.RedisRM { Rdb: rdb, }
sessions := sessions.RedisSM{ Rdb: rdb, }
log.Printf("Server will start on port %d\n", port)
log.Printf("Server will start on port: %d; listening to redis on: %d\n", port, redisPort)
routes.RegisterRoutes(sessions, roomsM)
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", port), nil))