You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
533 B
Go
27 lines
533 B
Go
2 years ago
|
package config
|
||
|
|
||
|
// pacakge serves to store/load config files for reactor
|
||
|
|
||
|
import (
|
||
|
"sync"
|
||
|
)
|
||
|
|
||
|
type ReactorConf struct {
|
||
|
Reactor ReactorConfig `mapstructure:"reactor"`
|
||
|
Devices map[int]DeviceConfig `mapstructure:"devices"`
|
||
|
sync.RWMutex
|
||
|
}
|
||
|
|
||
|
type DeviceConfig struct {
|
||
|
Address uint32 `mapstructure:"address"`
|
||
|
Interval uint32 `mapstructure:"interval"`
|
||
|
Name string `mapstructure:"name"`
|
||
|
}
|
||
|
|
||
|
// loaded in other file
|
||
|
func (c *ReactorConf) GetURL() (string, error) {
|
||
|
c.RLock()
|
||
|
defer c.RUnlock()
|
||
|
return c.Reactor.URL, nil
|
||
|
}
|