config

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultStaticFileTypes = []string{".js", ".png", ".jpg", ".jpeg", ".js", ".css", ".html", "svg"}

Functions

This section is empty.

Types

type Config

type Config struct {
	Definition string
	UserName   string
	Password   string
	Config     string
	// Format          string
	//除了指定Server外,允许单独指定Url前缀
	BaseUrl         string
	Server          string
	ServerVariables []string
	SourceMode      string
	StaticFileTypes []string
	Debug           int
	TimeFormat      string
	File            string
	//用于加载常见URL
	WellknownAPIs string

	//缓存文件的路径
	DbName string
	//IP Hash长度
	IPHashLength int
	// contains filtered or unexported fields
}

func NewFromReader

func NewFromReader(reader io.Reader, name, mode string) *Config

func (*Config) Check

func (c *Config) Check(loadWellknown bool) (err error)

func (*Config) GetBaseUrlFromDef

func (c *Config) GetBaseUrlFromDef(api *openapi3.T) (baseUrl string, err error)

func (*Config) GetFileName

func (c *Config) GetFileName() string

func (*Config) GetTimeFormat

func (c *Config) GetTimeFormat() string

func (*Config) HasFeatureDB added in v0.9.0

func (c *Config) HasFeatureDB() bool

func (*Config) IsLocalFile

func (c *Config) IsLocalFile() bool

func (*Config) IsStaticPath

func (c *Config) IsStaticPath(path string) bool

func (*Config) IsWellknownView

func (c *Config) IsWellknownView(path, method string) bool

func (*Config) LoadApi

func (c *Config) LoadApi(loadWellknown bool) (api *openapi3.T, baseUrl string, err error)

LoadApi 加载API定义文件, 如果loadWellknown为true,则在加载失败时,将尝试从wellknown中加载

func (*Config) LoadWellknownAsApi

func (c *Config) LoadWellknownAsApi() (api *openapi3.T, baseUrl string, err error)

LoadWellknownAsApi 将wellknown作为定义文件进行加载,主要为了初始使用或者体验使用,本函数调用时,wellknown应该已经加载完毕

func (*Config) OpenFile

func (c *Config) OpenFile() (io.Reader, error)

Jump to

Keyboard shortcuts

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