fix: Config should embed a pointer to s5config.NodeConfig

This commit is contained in:
Derrick Hammer 2024-02-23 08:18:05 -05:00
parent daf63268eb
commit 1a9fa9c4be
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
2 changed files with 5 additions and 3 deletions

View File

@ -8,7 +8,7 @@ import (
var _ config.ProtocolConfig = (*Config)(nil)
type Config struct {
s5config.NodeConfig
*s5config.NodeConfig
DbPath string `mapstructure:"db_path"`
}

View File

@ -145,12 +145,14 @@ func configureS5Protocol(proto *S5Protocol) (*s5config.NodeConfig, error) {
cfg.DB = db
return interface{}(cfg).(*s5config.NodeConfig), nil
return cfg.NodeConfig, nil
}
func (s *S5Protocol) Config() config.ProtocolConfig {
if s.config == nil {
s.config = &Config{}
s.config = &Config{
NodeConfig: &s5config.NodeConfig{},
}
}
return s.config