teldrive/utils/config.go

30 lines
638 B
Go
Raw Normal View History

2023-08-12 19:21:42 +08:00
package utils
import (
"github.com/kelseyhightower/envconfig"
)
type MultiToken string
type Config struct {
AppId int `envconfig:"APP_ID" required:"true"`
AppHash string `envconfig:"APP_HASH" required:"true"`
ChannelID int64 `envconfig:"CHANNEL_ID" required:"true"`
JwtSecret string `envconfig:"JWT_SECRET" required:"true"`
MultiClient bool `envconfig:"MULTI_CLIENT" default:"false"`
DatabaseUrl string `envconfig:"DATABASE_URL" required:"true"`
}
var config Config
func InitConfig() {
err := envconfig.Process("", &config)
if err != nil {
panic(err)
}
}
func GetConfig() *Config {
return &config
}