44 lines
719 B
Go
44 lines
719 B
Go
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,
|
|
},
|
|
}
|