settings

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 Save

func Save(settings *AppSettings) error

Save saves settings to the config file

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL