config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NewedEnvPrefix        string     = "NEWED"
	DefaultConfigFileBase string     = "newed"
	DefaultConfigExt      string     = "toml"
	DefaultLogLevel       slog.Level = slog.LevelInfo
)

Variables

This section is empty.

Functions

func WithFile

func WithFile(f string) func(*Config)

WithFile sets the configuration file and type.

If the file is empty, the default file name and type are used.

Types

type Config

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

func New

func New(options ...func(*Config)) (*Config, error)

func (Config) GetConfigFileUsed

func (c Config) GetConfigFileUsed() string

GetConfigFileUsed returns the configuration file used.

If no configuration file is loaded, an empty string is returned. Failure to read a configuration file does not cause an error and will still result in an empty string.

func (Config) GetLogger

func (c Config) GetLogger() *slog.Logger

func (Config) GetTemplateDirs

func (c Config) GetTemplateDirs() []string

type Key

type Key string

Key is a type for configuration keys.

const (
	// General configuration keys.
	LogLevelKey     Key = "logging"       // Configuration key for logging level.
	TemplateDirsKey Key = "template.dirs" // Configuration key for template directories.
)

func (Key) String

func (k Key) String() string

Jump to

Keyboard shortcuts

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