config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyInput = fmt.Errorf("input must have at least name or path")

Functions

This section is empty.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config provides an interface to read and write config values, thread safe.

func Get

func Get(i *Input) (*Config, error)

Get opens/reads or creates/writes a config file.

func (*Config) Settings added in v0.0.3

func (c *Config) Settings() *Settings

func (*Config) Start added in v0.0.3

func (c *Config) Start()

func (*Config) Stop added in v0.0.3

func (c *Config) Stop()

func (*Config) Update

func (c *Config) Update(settings *Settings) *Settings

Update merges in a new config.

func (*Config) Write

func (c *Config) Write(settings *Settings) (*Settings, error)

Write writes the config file and updates the running settings.

type Default added in v0.1.0

type Default struct {
	// Instance is a map of app => array id. map key is app name. eg. Sonarr.
	Instance map[string]int
}

Default holds items that can have default values.

type Input

type Input struct {
	// File path to config file. Optional.
	// Name and Dir are not used for config file path if this is provided.
	File string
	// Application name. Used to construct a config file path.
	// Also used for log file names. Overrides what's in config file.
	Name string
	// Sub-directory to put the config file into. Optional.
	Dir string
}

Input data to open a config file. If Dir!="" then config is placed in a sub directory.

type Settings added in v0.0.3

type Settings struct {
	logs.LogConfig
	Dark      bool
	DevMode   bool
	Updates   string
	File      string // should not be changed.
	Instances starrs.Instances
	Default
	Hide map[string]bool
}

Settings is the data read and written to/from the Settings file. Avoid pointers and complex types.

Jump to

Keyboard shortcuts

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