config

package
v1.16.2 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(configFile string, fs ...func()) error

func Set

func Set(conf *Config)

func Show

func Show(hiddenFields ...string) string

Types

type App

type App struct {
	CacheType             string  `yaml:"cacheType" json:"cacheType"`
	EnableCircuitBreaker  bool    `yaml:"enableCircuitBreaker" json:"enableCircuitBreaker"`
	EnableHTTPProfile     bool    `yaml:"enableHTTPProfile" json:"enableHTTPProfile"`
	EnableLimit           bool    `yaml:"enableLimit" json:"enableLimit"`
	EnableMetrics         bool    `yaml:"enableMetrics" json:"enableMetrics"`
	EnableStat            bool    `yaml:"enableStat" json:"enableStat"`
	EnableTrace           bool    `yaml:"enableTrace" json:"enableTrace"`
	Env                   string  `yaml:"env" json:"env"`
	Host                  string  `yaml:"host" json:"host"`
	Name                  string  `yaml:"name" json:"name"`
	RegistryDiscoveryType string  `yaml:"registryDiscoveryType" json:"registryDiscoveryType"`
	TracingSamplingRate   float64 `yaml:"tracingSamplingRate" json:"tracingSamplingRate"`
	Version               string  `yaml:"version" json:"version"`
}

type Cache

type Cache struct {
	CapacityBytes        int  `yaml:"capacityBytes" json:"capacityBytes"`
	Enabled              bool `yaml:"enabled" json:"enabled"`
	MaxItemSizeBytes     int  `yaml:"maxItemSizeBytes" json:"maxItemSizeBytes"`
	MaxResponseBodyBytes int  `yaml:"maxResponseBodyBytes" json:"maxResponseBodyBytes"`
}

type Center

type Center struct {
	Nacos Nacos `yaml:"nacos" json:"nacos"`
}

func NewCenter

func NewCenter(configFile string) (*Center, error)

type ClientSecure

type ClientSecure struct {
	CaFile     string `yaml:"caFile" json:"caFile"`
	CertFile   string `yaml:"certFile" json:"certFile"`
	KeyFile    string `yaml:"keyFile" json:"keyFile"`
	ServerName string `yaml:"serverName" json:"serverName"`
	Type       string `yaml:"type" json:"type"`
}

type ClientToken

type ClientToken struct {
	AppID  string `yaml:"appID" json:"appID"`
	AppKey string `yaml:"appKey" json:"appKey"`
	Enable bool   `yaml:"enable" json:"enable"`
}

type Config

type Config struct {
	Proxy      Proxy        `yaml:"proxy" json:"proxy"`
	Rails      Rails        `yaml:"rails" json:"rails"`
	Upstream   Upstream     `yaml:"upstream" json:"upstream"`
	App        App          `yaml:"app" json:"app"`
	Consul     Consul       `yaml:"consul" json:"consul"`
	Database   Database     `yaml:"database" json:"database"`
	Etcd       Etcd         `yaml:"etcd" json:"etcd"`
	Grpc       Grpc         `yaml:"grpc" json:"grpc"`
	GrpcClient []GrpcClient `yaml:"grpcClient" json:"grpcClient"`
	HTTP       HTTP         `yaml:"http" json:"http"`
	JWT        JWT          `yaml:"jwt" json:"jwt"`
	Jaeger     Jaeger       `yaml:"jaeger" json:"jaeger"`
	Logger     Logger       `yaml:"logger" json:"logger"`
	NacosRd    NacosRd      `yaml:"nacosRd" json:"nacosRd"`
	Redis      Redis        `yaml:"redis" json:"redis"`
}

func Get

func Get() *Config

type Consul

type Consul struct {
	Addr string `yaml:"addr" json:"addr"`
}

type Database

type Database struct {
	Driver     string     `yaml:"driver" json:"driver"`
	Mongodb    Mongodb    `yaml:"mongodb" json:"mongodb"`
	Mysql      Mysql      `yaml:"mysql" json:"mysql"`
	Postgresql Postgresql `yaml:"postgresql" json:"postgresql"`
	Sqlite     Sqlite     `yaml:"sqlite" json:"sqlite"`
}

type Etcd

type Etcd struct {
	Addrs []string `yaml:"addrs" json:"addrs"`
}

type Grpc

type Grpc struct {
	EnableToken  bool         `yaml:"enableToken" json:"enableToken"`
	HTTPPort     int          `yaml:"httpPort" json:"httpPort"`
	Port         int          `yaml:"port" json:"port"`
	ServerSecure ServerSecure `yaml:"serverSecure" json:"serverSecure"`
}

type GrpcClient

type GrpcClient struct {
	ClientSecure          ClientSecure `yaml:"clientSecure" json:"clientSecure"`
	ClientToken           ClientToken  `yaml:"clientToken" json:"clientToken"`
	Host                  string       `yaml:"host" json:"host"`
	Name                  string       `yaml:"name" json:"name"`
	Port                  int          `yaml:"port" json:"port"`
	RegistryDiscoveryType string       `yaml:"registryDiscoveryType" json:"registryDiscoveryType"`
	Timeout               int          `yaml:"timeout" json:"timeout"`
}

type HTTP

type HTTP struct {
	GzipJitter            int  `yaml:"gzipJitter" json:"gzipJitter"`
	GzipDisableOnAuth     bool `yaml:"gzipDisableOnAuth" json:"gzipDisableOnAuth"`
	AddRequestStartHeader bool `yaml:"addRequestStartHeader" json:"addRequestStartHeader"`
	GzipEnabled           bool `yaml:"gzipEnabled" json:"gzipEnabled"`
	HTTPSPort             int  `yaml:"httpsPort" json:"httpsPort"`
	IdleTimeout           int  `yaml:"idleTimeout" json:"idleTimeout"`
	LogRequests           bool `yaml:"logRequests" json:"logRequests"`
	MaxRequestBodyBytes   int  `yaml:"maxRequestBodyBytes" json:"maxRequestBodyBytes"`
	Port                  int  `yaml:"port" json:"port"`
	ReadTimeout           int  `yaml:"readTimeout" json:"readTimeout"`
	Timeout               int  `yaml:"timeout" json:"timeout"`
	TLS                   TLS  `yaml:"tls" json:"tls"`
	WriteTimeout          int  `yaml:"writeTimeout" json:"writeTimeout"`
}

type HealthCheck

type HealthCheck struct {
	IntervalSeconds int `yaml:"intervalSeconds" json:"intervalSeconds"`
	TimeoutSeconds  int `yaml:"timeoutSeconds" json:"timeoutSeconds"`
}

type JWT

type JWT struct {
	SigningKey string `yaml:"signingKey" json:"signingKey"`
	Expire     int    `yaml:"expire" json:"expire"` // seconds
}

type Jaeger

type Jaeger struct {
	AgentHost string `yaml:"agentHost" json:"agentHost"`
	AgentPort int    `yaml:"agentPort" json:"agentPort"`
}

type Logger

type Logger struct {
	Format string `yaml:"format" json:"format"`
	IsSave bool   `yaml:"isSave" json:"isSave"`
	Level  string `yaml:"level" json:"level"`
}

type Management

type Management struct {
	BasePath string `yaml:"basePath" json:"basePath"`
	Enabled  bool   `yaml:"enabled" json:"enabled"`
}

type Mongodb

type Mongodb struct {
	Dsn string `yaml:"dsn" json:"dsn"`
}

type Mysql

type Mysql struct {
	ConnMaxLifetime int      `yaml:"connMaxLifetime" json:"connMaxLifetime"`
	Dsn             string   `yaml:"dsn" json:"dsn"`
	EnableLog       bool     `yaml:"enableLog" json:"enableLog"`
	MastersDsn      []string `yaml:"mastersDsn" json:"mastersDsn"`
	MaxIdleConns    int      `yaml:"maxIdleConns" json:"maxIdleConns"`
	MaxOpenConns    int      `yaml:"maxOpenConns" json:"maxOpenConns"`
	SlavesDsn       []string `yaml:"slavesDsn" json:"slavesDsn"`
}

type Nacos

type Nacos struct {
	ContextPath string `yaml:"contextPath" json:"contextPath"`
	DataID      string `yaml:"dataID" json:"dataID"`
	Format      string `yaml:"format" json:"format"`
	Group       string `yaml:"group" json:"group"`
	IPAddr      string `yaml:"ipAddr" json:"ipAddr"`
	NamespaceID string `yaml:"namespaceID" json:"namespaceID"`
	Port        int    `yaml:"port" json:"port"`
	Scheme      string `yaml:"scheme" json:"scheme"`
}

type NacosRd

type NacosRd struct {
	IPAddr      string `yaml:"ipAddr" json:"ipAddr"`
	NamespaceID string `yaml:"namespaceID" json:"namespaceID"`
	Port        int    `yaml:"port" json:"port"`
}

type Postgresql

type Postgresql struct {
	ConnMaxLifetime int    `yaml:"connMaxLifetime" json:"connMaxLifetime"`
	Dsn             string `yaml:"dsn" json:"dsn"`
	EnableLog       bool   `yaml:"enableLog" json:"enableLog"`
	MaxIdleConns    int    `yaml:"maxIdleConns" json:"maxIdleConns"`
	MaxOpenConns    int    `yaml:"maxOpenConns" json:"maxOpenConns"`
}

type Proxy

type Proxy struct {
	BadGatewayPage   string      `yaml:"badGatewayPage" json:"badGatewayPage"`
	Cache            Cache       `yaml:"cache" json:"cache"`
	Enabled          bool        `yaml:"enabled" json:"enabled"`
	ForwardHeaders   bool        `yaml:"forwardHeaders" json:"forwardHeaders"`
	H2cEnabled       bool        `yaml:"h2cEnabled" json:"h2cEnabled"`
	HealthCheck      HealthCheck `yaml:"healthCheck" json:"healthCheck"`
	Management       Management  `yaml:"management" json:"management"`
	Strategy         string      `yaml:"strategy" json:"strategy"`
	TargetURL        string      `yaml:"targetURL" json:"targetURL"`
	XSendfileEnabled bool        `yaml:"xSendfileEnabled" json:"xSendfileEnabled"`
}

type Rails

type Rails struct {
	CookieName    string `yaml:"cookieName" json:"cookieName"`
	SecretKeyBase string `yaml:"secretKeyBase" json:"secretKeyBase"`
	UserID        int    `yaml:"userID" json:"userID"`
}

type Redis

type Redis struct {
	DialTimeout  int    `yaml:"dialTimeout" json:"dialTimeout"`
	Dsn          string `yaml:"dsn" json:"dsn"`
	ReadTimeout  int    `yaml:"readTimeout" json:"readTimeout"`
	WriteTimeout int    `yaml:"writeTimeout" json:"writeTimeout"`
}

type RemoteAPI

type RemoteAPI struct {
	Headers map[string]string `yaml:"headers" json:"headers"`
	Timeout int               `yaml:"timeout" json:"timeout"`
	URL     string            `yaml:"url" json:"url"`
}

type ServerSecure

type ServerSecure struct {
	CaFile   string `yaml:"caFile" json:"caFile"`
	CertFile string `yaml:"certFile" json:"certFile"`
	KeyFile  string `yaml:"keyFile" json:"keyFile"`
	Type     string `yaml:"type" json:"type"`
}

type Sqlite

type Sqlite struct {
	ConnMaxLifetime int    `yaml:"connMaxLifetime" json:"connMaxLifetime"`
	DBFile          string `yaml:"dbFile" json:"dbFile"`
	EnableLog       bool   `yaml:"enableLog" json:"enableLog"`
	MaxIdleConns    int    `yaml:"maxIdleConns" json:"maxIdleConns"`
	MaxOpenConns    int    `yaml:"maxOpenConns" json:"maxOpenConns"`
}

type TLS

type TLS struct {
	CertFile     string    `yaml:"certFile" json:"certFile"`
	Domain       string    `yaml:"domain" json:"domain"`
	Domains      []string  `yaml:"domains" json:"domains"`
	Email        string    `yaml:"email" json:"email"`
	EnableMode   string    `yaml:"enableMode" json:"enableMode"`
	KeyFile      string    `yaml:"keyFile" json:"keyFile"`
	RedirectHTTP bool      `yaml:"redirectHTTP" json:"redirectHTTP"`
	RemoteAPI    RemoteAPI `yaml:"remoteAPI" json:"remoteAPI"`
	StoragePath  string    `yaml:"storagePath" json:"storagePath"`
}

type Upstream

type Upstream struct {
	Args             []string          `yaml:"args" json:"args"`
	Command          string            `yaml:"command" json:"command"`
	Enabled          bool              `yaml:"enabled" json:"enabled"`
	Env              map[string]string `yaml:"env" json:"env"`
	StopSignal       string            `yaml:"stopSignal" json:"stopSignal"`
	TargetBindSocket string            `yaml:"targetBindSocket" json:"targetBindSocket"`
	TargetPort       int               `yaml:"targetPort" json:"targetPort"`
	WorkingDirectory string            `yaml:"workingDirectory" json:"workingDirectory"`
}

Jump to

Keyboard shortcuts

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