u
This commit is contained in:
1 parent
ac0843c041
commit
a917be08d1
65 files changed
+8043
No files matched your search
@@ -0,0 +1,43 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type appConfig struct {
|
||||
Server serverConfig
|
||||
JWT jwtConfig
|
||||
Snowflake snowflakeConfig
|
||||
}
|
||||
|
||||
type serverConfig struct {
|
||||
Port string
|
||||
BaseUrl string
|
||||
}
|
||||
|
||||
type jwtConfig struct {
|
||||
Secret string
|
||||
AccessExpiry time.Duration
|
||||
RefreshExpiry time.Duration
|
||||
}
|
||||
|
||||
type snowflakeConfig struct {
|
||||
DatacenterID uint16
|
||||
WorkerID uint16
|
||||
}
|
||||
|
||||
var App = &appConfig{
|
||||
Server: serverConfig{
|
||||
Port: ":8086",
|
||||
BaseUrl: "/app",
|
||||
},
|
||||
JWT: jwtConfig{
|
||||
Secret: "3Bde3BGEbYqtqyEUzW3ry8jKFcaPH17fRmTmqE7MDr05Lwj95uruRKrrkb44TJ4s",
|
||||
AccessExpiry: 30 * time.Minute,
|
||||
RefreshExpiry: 30 * 24 * time.Hour,
|
||||
},
|
||||
Snowflake: snowflakeConfig{
|
||||
DatacenterID: 1,
|
||||
WorkerID: 1,
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type dbConfig struct {
|
||||
Host string
|
||||
Port int
|
||||
User string
|
||||
Password string
|
||||
Dbname string
|
||||
SllMode bool
|
||||
TimeZone string
|
||||
MaxOpenConns int
|
||||
MaxIdleConns int
|
||||
ConnMaxLifetime time.Duration
|
||||
}
|
||||
|
||||
// Db 默认值
|
||||
var Db = &dbConfig{
|
||||
Host: "117.72.182.135",
|
||||
Port: 5432,
|
||||
User: "postgres",
|
||||
Password: "zhang520..",
|
||||
Dbname: "base",
|
||||
SllMode: false,
|
||||
TimeZone: "Asia/Shanghai",
|
||||
MaxOpenConns: 10,
|
||||
MaxIdleConns: 5,
|
||||
ConnMaxLifetime: 30 * time.Minute,
|
||||
}
|
||||
Reference in new issue
Block a user