Sergey Cherepanov 5729a32959
consensus node
2022-10-04 15:39:29 +03:00

49 lines
921 B
Go

package config
import (
"github.com/anytypeio/go-anytype-infrastructure-experiments/app"
"github.com/anytypeio/go-anytype-infrastructure-experiments/config"
"gopkg.in/yaml.v3"
"io/ioutil"
)
const CName = "config"
func NewFromFile(path string) (c *Config, err error) {
c = &Config{}
data, err := ioutil.ReadFile(path)
if err != nil {
return nil, err
}
if err = yaml.Unmarshal(data, c); err != nil {
return nil, err
}
return
}
type Config struct {
GrpcServer config.GrpcServer `yaml:"grpcServer"`
Account config.Account `yaml:"account"`
Mongo Mongo `yaml:"mongo"`
}
func (c *Config) Init(a *app.App) (err error) {
return
}
func (c Config) Name() (name string) {
return CName
}
func (c Config) GetMongo() Mongo {
return c.Mongo
}
func (c Config) GetGRPCServer() config.GrpcServer {
return c.GrpcServer
}
func (c Config) GetAccount() config.Account {
return c.Account
}