config

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2025 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorNoConfigFound   = errors.New("no config attached to the current context")
	ErrorConfigMissMatch = errors.New("config was removed or replaced, key is defined but type miss match")
)

Functions

func Attach

func Attach(ctx context.Context, cfg *Config) context.Context

Types

type AuthRule

type AuthRule struct {
	BasePath []string `mapstructure:"path"`
	Tokens   []string `mapstructure:"token"`
}

type Config

type Config struct {
	HTTPListenAddr string `mapstructure:"http_listen" env:"HTTP_LISTEN"`

	BaseURL string `mapstructure:"base_url" env:"BASE_URL"`

	PubStorage string `mapstructure:"pub_storage" default:"./storage/pub"`

	Auth []AuthRule `mapstructure:"auth"`
}

func Get

func Get(ctx context.Context) (*Config, error)

func GetForce

func GetForce(ctx context.Context) *Config

func ReadConfig

func ReadConfig(ctx context.Context, conf string) (*Config, error)

type CtxKey

type CtxKey string

Jump to

Keyboard shortcuts

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