42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
package config
|
|
|
|
import (
|
|
"github.com/gofiber/storage/redis/v3"
|
|
)
|
|
|
|
type Config struct {
|
|
DBConnString string
|
|
RedisAddr string
|
|
JWTSecret string
|
|
APIUser string
|
|
APIPassword string
|
|
APITokenUrl string
|
|
APIUserUrl string
|
|
APIStudentUrl string
|
|
APIParentUrl string
|
|
}
|
|
|
|
func New() *Config {
|
|
return &Config{
|
|
DBConnString: "root:password@tcp(localhost:3306)/testfb?charset=utf8mb4&parseTime=True&loc=Local",
|
|
RedisAddr: "localhost",
|
|
JWTSecret: "your-secret-key",
|
|
APIUser: "Ekatong",
|
|
APIPassword: "kBzrhWnEArk2AJskj8",
|
|
APITokenUrl: "https://wlkj.suzhou.edu.cn/v1/api/edu/suzhou/app-user/login",
|
|
APIUserUrl: "https://wlkj.suzhou.edu.cn/v1/api/edu/suzhou/user/one/nationalId",
|
|
APIStudentUrl: "https://wlkj.suzhou.edu.cn/v1/api/edu/suzhou/student/find-by-nationalId",
|
|
APIParentUrl: "https://wlkj.suzhou.edu.cn/v1/api/edu/suzhou/student/find-by-parent",
|
|
}
|
|
}
|
|
|
|
func InitRedis(addr string) *redis.Storage {
|
|
return redis.New(redis.Config{
|
|
Host: addr,
|
|
Port: 6379,
|
|
Username: "",
|
|
Password: "",
|
|
Database: 0,
|
|
})
|
|
}
|