...

Package config

import "github.com/go-kivik/kivik/v4/x/server/config"
Overview
Index

Overview ▾

Package config manages server configuration.

type Config

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

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
}

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

Writer allows setting server configuration.

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)
}