configloader

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: MIT Imports: 9 Imported by: 0

README

ConfigLoader

A simple config loader that watches (and polls) a YAML file on disk, reads and parses it when it changes, and makes the contents available to subscribers and readers.

The loader is generic; you can provide your own type for the loader to use. See the unit test for an example.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigLoader

type ConfigLoader[Config any] struct {
	// contains filtered or unexported fields
}

func NewConfigLoader

func NewConfigLoader[Config any](path string) (ret *ConfigLoader[Config], err error)

This might return an error and a valid config loader.

func (*ConfigLoader[Config]) Close

func (b *ConfigLoader[Config]) Close()

func (*ConfigLoader[Config]) Config

func (b *ConfigLoader[Config]) Config() (conf *Config)

func (*ConfigLoader[Config]) Load

func (b *ConfigLoader[Config]) Load(path string) error

func (*ConfigLoader[Config]) SetConfigPath

func (b *ConfigLoader[Config]) SetConfigPath(path string) error

func (*ConfigLoader[Config]) Subscribe

func (b *ConfigLoader[Config]) Subscribe() chan Config

Jump to

Keyboard shortcuts

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