config

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ProjectDir  string `yaml:"project_dir"`
	Server      ServerConfig
	Log         LogConfig
	Recovery    RecoveryConfig     `yaml:"recovery"`
	OpenAPI     OpenAPIConfig      `yaml:"openapi"`
	Middlewares map[string]Section `yaml:"middlewares"`
}

func Default

func Default() Config

func Load

func Load(path string) (Config, error)

type LogConfig

type LogConfig struct {
	Level          string `yaml:"level"`
	Output         string `yaml:"output"`
	FilePath       string `yaml:"file_path"`
	EnableFile     bool   `yaml:"enable_file"`
	RequestEnabled bool   `yaml:"request_enabled"`
}

type OpenAPIConfig

type OpenAPIConfig struct {
	Enabled bool   `yaml:"enabled"`
	Output  string `yaml:"output"`
	Title   string `yaml:"title"`
	Version string `yaml:"version"`
}

type RecoveryConfig

type RecoveryConfig struct {
	Enabled           bool `yaml:"enabled"`
	ReturnStackToBody bool `yaml:"return_stack_to_body"`
}

type Section

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

func NewSection

func NewSection(data map[string]any) Section

func (Section) Get

func (s Section) Get(key string) string

func (Section) GetBool

func (s Section) GetBool(key string) bool

func (Section) GetBoolDefault

func (s Section) GetBoolDefault(key string, defaultValue bool) bool

func (Section) GetDuration

func (s Section) GetDuration(key string) time.Duration

func (Section) GetDurationDefault

func (s Section) GetDurationDefault(key string, defaultValue time.Duration) time.Duration

func (Section) GetFloat

func (s Section) GetFloat(key string) float64

func (Section) GetFloat64

func (s Section) GetFloat64(key string) float64

func (Section) GetFloat64Default

func (s Section) GetFloat64Default(key string, defaultValue float64) float64

func (Section) GetFloatDefault

func (s Section) GetFloatDefault(key string, defaultValue float64) float64

func (Section) GetInt

func (s Section) GetInt(key string) int

func (Section) GetInt64

func (s Section) GetInt64(key string) int64

func (Section) GetInt64Default

func (s Section) GetInt64Default(key string, defaultValue int64) int64

func (Section) GetIntDefault

func (s Section) GetIntDefault(key string, defaultValue int) int

func (Section) GetString

func (s Section) GetString(key string) string

func (Section) GetStringDefault

func (s Section) GetStringDefault(key string, defaultValue string) string

func (Section) GetStrings

func (s Section) GetStrings(key string) []string

func (Section) GetStringsDefault

func (s Section) GetStringsDefault(key string, defaultValue []string) []string

func (Section) Has

func (s Section) Has(key string) bool

func (Section) MustGet

func (s Section) MustGet(key string) string

func (Section) Raw

func (s Section) Raw(key string) any

func (Section) Sub

func (s Section) Sub(key string) *Section

func (*Section) UnmarshalYAML

func (s *Section) UnmarshalYAML(node *yaml.Node) error

type ServerConfig

type ServerConfig struct {
	Host string `yaml:"host"`
	Port int    `yaml:"port"`
}

Jump to

Keyboard shortcuts

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