config

package
v4.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package config manages server configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config interface {
	All(context.Context) (map[string]map[string]string, error)
	Section(context.Context, string) (map[string]string, error)
	Key(context.Context, string, string) (string, error)
	Reload(context.Context) error
}

Config provides access to read server configuration. Configuration backends that allow modifying configuraiont will also implement [ConfigWriter].

func Default

func Default() Config

Default returns a Config implementation which returns default values for all configuration options, and preserves changed settings only until restart.

func Map

func Map(conf map[string]map[string]string) Config

Map returns a Config implementation which returns the provided configuration.

type Writer

type Writer interface {
	// SetKey sets a new config value, and returns the old value.
	SetKey(context.Context, string, string, string) (string, error)
	Delete(context.Context, string, string) (string, error)
}

Writer allows setting server configuration.

Jump to

Keyboard shortcuts

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