config

package
v0.0.0-...-55524bd Latest Latest
Warning

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

Go to latest
Published: May 30, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultPath = "./configs/polyapi.yaml"

DefaultPath is default config file path

Functions

This section is empty.

Types

type AuthorizeConfig

type AuthorizeConfig struct {
	OauthToken OauthConfig `yaml:"oauthToken"`
	OauthKey   OauthConfig `yaml:"oauthKey"`
	Goalie     OauthConfig `yaml:"goalie"`
	FileServer OauthConfig `yaml:"fileServer"`
	AppAccess  OauthConfig `yaml:"appAccess"`
	AppAdmin   OauthConfig `yaml:"appAdmin"`
}

AuthorizeConfig presents URLs of auth config

type Config

type Config struct {
	Port       string          `yaml:"port"`
	PortInner  string          `yaml:"portInner"`
	Model      string          `yaml:"model"`
	MyHostBase string          `yaml:"myHostBase"`
	Gate       Gate            `yaml:"gate"`
	Authorize  AuthorizeConfig `yaml:"authorize"`
	Log        logger.Config   `yaml:"log"`
	Mysql      mysql2.Config   `yaml:"mysql"`
	Redis      redis2.Config   `yaml:"redis"`
}

Config presents config

var Conf *Config

Conf config

func NewConfig

func NewConfig(path string) (*Config, error)

NewConfig load config file

type Gate

type Gate struct {
	LimitRate GateLimitRate `yaml:"limitRate"`
	APIBlock  GateAPIBlock  `yaml:"apiBlock"`
	IPBlock   GateIPBlock   `yaml:"ipBlock"`
}

Gate config

type GateAPIBlock

type GateAPIBlock struct {
	Enable        bool  `yaml:"enable" validate:"required"`
	MaxAllowError int64 `yaml:"maxAllowError" validate:"required,min=1,max=100"`
	BlockSeconds  int64 `yaml:"blockSeconds" validate:"required,min=10,max=3600"`
	APITimeoutMS  int64 `yaml:"apiTimeoutMS" validate:"required,min=1"`
}

GateAPIBlock config

type GateIPBlock

type GateIPBlock struct {
	Enable bool     `yaml:"enable" validate:"required"`
	White  []string `yaml:"white"`
	Black  []string `yaml:"black"`
}

GateIPBlock config

type GateLimitRate

type GateLimitRate struct {
	Enable        bool `yaml:"enable" validate:"required"`
	RatePerSecond int  `yaml:"ratePerSecond" validate:"required,min=1,max=100000"`
}

GateLimitRate config

type OauthConfig

type OauthConfig struct {
	Addr         string        `yaml:"addr"`
	MaxIdleConns int           `yaml:"maxIdleConns"`
	Timeout      time.Duration `yaml:"timeout"`
}

OauthConfig config url for authorize

Jump to

Keyboard shortcuts

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