32 lines
639 B
Go
32 lines
639 B
Go
package config
|
|
|
|
import (
|
|
"github.com/gofiber/storage/redis/v3"
|
|
)
|
|
|
|
type Config struct {
|
|
DBConnString string
|
|
RedisAddr string
|
|
JWTSecret string
|
|
ErrInvalidPassword string
|
|
}
|
|
|
|
func New() *Config {
|
|
return &Config{
|
|
DBConnString: "root:password@tcp(localhost:3306)/testfb?charset=utf8mb4&parseTime=True&loc=Local",
|
|
RedisAddr: "localhost:6379",
|
|
JWTSecret: "your-secret-key",
|
|
ErrInvalidPassword: "Invalid password",
|
|
}
|
|
}
|
|
|
|
func InitRedis(addr string) *redis.Storage {
|
|
return redis.New(redis.Config{
|
|
Host: addr,
|
|
Port: 6379,
|
|
Username: "",
|
|
Password: "",
|
|
Database: 0,
|
|
})
|
|
}
|