config

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UnitsMgdl = "mg/dL"
	UnitsMmol = "mmol/L"
)
View Source
const LocalFileFormatCsv = "csv"

Variables

View Source
var Default = NewDefault()

Functions

func AddReloader

func AddReloader(fn func())

func GetDir

func GetDir() (string, error)

func Load

func Load() error

func Watch

func Watch() error

func Write

func Write() error

Types

type Arrows

type Arrows struct {
	DoubleUp      string `toml:"double-up"`
	SingleUp      string `toml:"single-up"`
	FortyFiveUp   string `toml:"forty-five-up"`
	Flat          string `toml:"flat"`
	FortyFiveDown string `toml:"forty-five-down"`
	SingleDown    string `toml:"single-down"`
	DoubleDown    string `toml:"double-down"`
	Unknown       string `toml:"unknown"`
}

type Config

type Config struct {
	Title     string    `toml:"title" comment:"Tray title."`
	URL       string    `toml:"url" comment:"Nightscout URL. (required)"`
	Token     string    `toml:"token" comment:"Nightscout token. Using an access token is recommended instead of the API secret."`
	Units     string    `toml:"units" comment:"Blood sugar unit. (one of: mg/dL, mmol/L)"`
	Interval  Duration  `toml:"interval" comment:"Update interval."`
	Arrows    Arrows    `toml:"arrows" comment:"Customize the arrows."`
	LocalFile LocalFile `toml:"local-file" comment:"Enables writing the latest blood sugar to a local temporary file."`
}

func NewDefault

func NewDefault() Config

type Duration

type Duration struct {
	time.Duration
}

func (Duration) MarshalText

func (d Duration) MarshalText() (text []byte, err error)

func (*Duration) UnmarshalText

func (d *Duration) UnmarshalText(text []byte) error

type LocalFile

type LocalFile struct {
	Enabled bool   `toml:"enabled"`
	Format  string `toml:"format" comment:"Local file format. (one of: csv)"`
	Path    string `toml:"path" comment:"Local file path. $TMPDIR will be replaced with the current temp directory."`
	Cleanup bool   `toml:"cleanup" comment:"If enabled, the local file will be cleaned up when Nightscout Menu Bar is closed."`
}

type TOMLParser

type TOMLParser struct{}

func (TOMLParser) Marshal

func (p TOMLParser) Marshal(o map[string]interface{}) ([]byte, error)

func (TOMLParser) Unmarshal

func (p TOMLParser) Unmarshal(b []byte) (map[string]interface{}, error)

Jump to

Keyboard shortcuts

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