teldrive/utils/config.go
2023-08-12 16:51:42 +05:30

29 lines
638 B
Go

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
}