package config // def.go serves as a central place to view/edit config structs and device manager map /* Notes: - I think that this is scuffed as all hell and I can probably vastly improve this. - First order of buisness is to rework these definitons to even make sense - What does the server ACTUALLY need to know and vice versa for a reactor */ import ( "sync" ) // Server Config type ServerConf struct { // Structure to demarshall into Server ServerConfig `mapstructure:"server"` // I think this is unnessecary, who the hell cares? //Reactors map[string]ReactorConfig `mapstructure:"reactors"` sync.RWMutex } type ServerConfig struct { // Server config settings URL string `mapstructure:"db-url"` Token string `mapstructure:"db-token"` Orginization string `mapstructure:"db-org"` Ports map[string]int `mapstructure:"ports"` // changed from map[string]string to map[string]int Name string `mapstructure:"name"` } // Reactor Config type ReactorConf struct { // Structure to demarshall to Reactor ReactorConfig `mapstructure:"reactor"` // I think this is also unnessecary, again what does it matter? // Devices map[int]DeviceConfig `mapstructure:"devices"` sync.RWMutex } type ReactorConfig struct { // Reactor config settings Token string `mapstructure:"db-token"` Bucket string `mapstructure:"db-bucket"` URL string `mapstructure:"db-url",omitempty` // only needed by reactor Name string `mapstructure:"name",omitempty` // not always set Id uint32 `mapstructure:"id"` } // Device Config type DeviceConfig struct { // Device config settings Address uint32 `mapstructure:"address"` Interval uint32 `mapstructure:"interval"` Name string `mapstructure:"name"` }