web

package
v0.2.19 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrCodeHandler

func ErrCodeHandler(c *gin.Context)

func FlagSet

func FlagSet(defaultPort int) *pflag.FlagSet

func New

func New(conf *Config, applyFunc func(*gin.RouterGroup)) (*http.Server, error)

func Routes added in v0.1.7

func Routes() []gin.RouteInfo

func SetVersionHandler added in v0.2.4

func SetVersionHandler(name, version, commit string)

Types

type Config

type Config struct {
	System    string   `json:"system" yaml:"system"`
	Prefix    string   `json:"prefix" yaml:"prefix" default:"/api"`
	Endpoint  string   `json:"endpoint" yaml:"endpoint"`
	Host      string   `json:"host" yaml:"host" default:"127.0.0.1"`
	Port      int      `json:"port" yaml:"port" default:"8080"`
	Origins   []string `json:"origins" yaml:"origins"`
	Headers   []string `json:"headers" yaml:"headers"`
	Debug     bool     `json:"debug" yaml:"debug"`
	Pprof     bool     `json:"pprof" yaml:"pprof"`
	RequestID bool     `json:"requestid" yaml:"requestid"`
	Metrics   bool     `json:"metrics" yaml:"metrics"`
	Auth      bool     `json:"auth" yaml:"auth"`
}

func (*Config) Addr

func (c *Config) Addr() string

func (*Config) Check

func (c *Config) Check() *Config

func (*Config) GetEndpoint

func (c *Config) GetEndpoint() string

func (*Config) WithAuth

func (s *Config) WithAuth(v bool) *Config

func (*Config) WithDebug

func (s *Config) WithDebug(v bool) *Config

func (*Config) WithEndpoint

func (s *Config) WithEndpoint(v string) *Config

func (*Config) WithHeaders

func (s *Config) WithHeaders(v []string) *Config

func (*Config) WithHost

func (s *Config) WithHost(v string) *Config

func (*Config) WithMetrics

func (s *Config) WithMetrics(v bool) *Config

func (*Config) WithOrigins

func (s *Config) WithOrigins(v []string) *Config

func (*Config) WithPort

func (s *Config) WithPort(v int) *Config

func (*Config) WithPprof

func (s *Config) WithPprof(v bool) *Config

func (*Config) WithPrefix

func (s *Config) WithPrefix(v string) *Config

func (*Config) WithRequestID

func (s *Config) WithRequestID(v bool) *Config

func (*Config) WithSystem

func (s *Config) WithSystem(v string) *Config

type Token added in v0.2.7

type Token struct {
	Disable bool   `json:"disable" yaml:"disable"`
	KeyName string `json:"keyname" yaml:"keyname"`
	APIKey  string `json:"apikey" yaml:"apikey"`
	System  string `json:"system" yaml:"system"`
}

Jump to

Keyboard shortcuts

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