config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2025 License: Unlicense Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfigPath

func GetConfigPath() string

gets config path, creating paths if they don't exist or panics.

func GetPath

func GetPath() string

func PopulateJson

func PopulateJson[T any, P Ptr[T]](p string, v P) (int, error)

populates v with contents of <configdir>/filename.json

Types

type Libraries

type Libraries struct {
	AutoLoad bool     `json:"autoLoad"`
	Paths    []string `json:"paths"`
}

type Nest

type Nest struct {
	Port int `json:"port"`
}

type NestConfig

type NestConfig struct {
	Libraries   Libraries `json:"libraries"`
	Directories []string  `json:"directories"`
	Port        int       `json:"port"`
	Host        string    `json:"host"`
	ApiKey      string    `json:"apiKey,omitempty"`
	Nest        Nest      `json:"nest"`
}

todo use eagle instead of flat autoload/paths

func GetConfig

func GetConfig() NestConfig

func GetConfigV0

func GetConfigV0() NestConfig

load once during startup. [ ] - validate config

func MustNewConfig

func MustNewConfig() (string, NestConfig)

creates config path at `~/.config/nest/config.json and creates necessary elements or panics

func MustNewConfigAndPopulateLibs

func MustNewConfigAndPopulateLibs() (string, NestConfig)

also populates libraries with defaults from eagle. creates config path at `~/.config/nest/config.json and creates necessary elements or panics

func (NestConfig) BaseURL

func (n NestConfig) BaseURL() string

"http://<host>:<port>"

func (NestConfig) FmtURL

func (n NestConfig) FmtURL() string

"http://<host>:<port>"

type Ptr

type Ptr[T any] interface{ *T }

Ptr is a type constraint for pointers to any type.

Jump to

Keyboard shortcuts

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