voidwalker/configs/configs.go
Niko Storni 2dc0db7210 add compression for gifs
add database backend
2020-06-16 05:37:51 +02:00

40 lines
990 B
Go

package configs
import (
"time"
"github.com/lbryio/lbry.go/v2/extras/errors"
"github.com/tkanos/gonfig"
)
type DbConfig struct {
Host string `json:"host"`
User string `json:"user"`
Database string `json:"database"`
Password string `json:"password"`
}
type Configs struct {
Chainquery DbConfig `json:"chainquery"`
Speech DbConfig `json:"speech"`
Voidwalker DbConfig `json:"voidwalker"`
ChannelID string `json:"channel_id"`
PublishAddress string `json:"publish_address"`
ReflectorServer string `json:"reflector_server"`
LbrynetTimeout time.Duration `json:"lbrynet_timeout"`
PreviousChannelIds []string `json:"previous_channel_ids"`
}
var Configuration *Configs
func Init(configPath string) error {
if Configuration != nil {
return nil
}
c := Configs{}
err := gonfig.GetConf(configPath, &c)
if err != nil {
return errors.Err(err)
}
Configuration = &c
return nil
}