Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPath ¶
func GetPath() string
GetPath returns the OS-appropriate path for settings.json Returns empty string if config directory cannot be determined
func SaveTo ¶
func SaveTo(settings *AppSettings, path string) error
SaveTo saves settings to a specific path
Types ¶
type AppSettings ¶
type AppSettings struct {
ModbusBasePort int `json:"modbusBasePort"`
MQTTBasePort int `json:"mqttBasePort"`
OCPPBasePort int `json:"ocppBasePort"`
ModbusDisplayOffset int `json:"modbusDisplayOffset"`
MQTTDisplayOffset int `json:"mqttDisplayOffset"`
OCPPDisplayOffset int `json:"ocppDisplayOffset"`
SiteTickMs int `json:"siteTickMs"`
}
AppSettings holds persistent application settings
func DefaultSettings ¶
func DefaultSettings() *AppSettings
DefaultSettings returns settings with default values
func Load ¶
func Load() *AppSettings
Load loads settings from the config file Returns default settings if file doesn't exist or can't be read
func LoadFrom ¶
func LoadFrom(path string) *AppSettings
LoadFrom loads settings from a specific path Returns default settings if file doesn't exist or can't be read