Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultConfigPath() string
- func InitGlobalProvider(provider *Provider)
- func NewDefaultViperProto() *viper.ViperProto
- func SetGlobalProvider(provider *Provider)
- type CompletedConfig
- type Config
- type ConfigOption
- type ConfigOptionFunc
- type EmptyConfigOption
- type Provider
- func (p *Provider) Context() context.Context
- func (p *Provider) GetBackendAdvertiseHostPort() string
- func (p *Provider) GetBackendBindHostPort() string
- func (p *Provider) GetBackendServeHostPort() string
- func (p *Provider) GetCORS() gin.HandlerFunc
- func (p *Provider) HTTPScheme() string
- func (p *Provider) KeyCipher() *pasta.Pasta
- func (p *Provider) Proto() *viper_.ViperProto
- func (p *Provider) ReloadForever()
- func (p *Provider) ResolveBackendLocalUrl(relativePaths ...string) string
- func (p *Provider) SqlDB() *sqlx.DB
- func (p *Provider) SqlDBPing() error
Constants ¶
View Source
const (
DefaultTimeout = time.Minute
)
Variables ¶
View Source
var ForceDisableTls bool
Functions ¶
func DefaultConfigPath ¶
func DefaultConfigPath() string
DefaultConfigPath returns config file's default path
func InitGlobalProvider ¶
func InitGlobalProvider(provider *Provider)
func NewDefaultViperProto ¶
func NewDefaultViperProto() *viper.ViperProto
func SetGlobalProvider ¶
func SetGlobalProvider(provider *Provider)
Types ¶
type CompletedConfig ¶
type CompletedConfig struct {
// contains filtered or unexported fields
}
func (CompletedConfig) Apply ¶
Apply set options and something else as global init, act likes New but without Config's instance Apply usually called after Complete
type Config ¶
type Config struct { ConfigFile string Logs *logs.Config OpenTracer *opentrace.Config CORS *cors.Config KeyCipher *pasta.Config Sql *sql.Config Redis *redis_.Config // contains filtered or unexported fields }
func (*Config) ApplyOptions ¶
func (o *Config) ApplyOptions(options ...ConfigOption) *Config
func (*Config) Complete ¶
func (o *Config) Complete(options ...ConfigOption) CompletedConfig
Complete fills in any fields not set that are required to have valid data and can be derived from other fields. If you're going to ApplyOptions, do that first. It's mutating the receiver. ApplyOptions is called inside.
type ConfigOption ¶
type ConfigOption interface {
// contains filtered or unexported methods
}
A ConfigOption sets options.
type ConfigOptionFunc ¶
type ConfigOptionFunc func(*Config)
ConfigOptionFunc wraps a function that modifies Config into an implementation of the ConfigOption interface.
type EmptyConfigOption ¶
type EmptyConfigOption struct{}
EmptyConfigOption does not alter the configuration. It can be embedded in another structure to build custom options.
This API is EXPERIMENTAL.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
func GlobalProvider ¶
func GlobalProvider() *Provider
func (*Provider) GetBackendAdvertiseHostPort ¶
func (*Provider) GetBackendBindHostPort ¶
func (*Provider) GetBackendServeHostPort ¶
func (*Provider) GetCORS ¶
func (p *Provider) GetCORS() gin.HandlerFunc
func (*Provider) HTTPScheme ¶
func (*Provider) Proto ¶
func (p *Provider) Proto() *viper_.ViperProto
func (*Provider) ReloadForever ¶ added in v0.0.13
func (p *Provider) ReloadForever()
func (*Provider) ResolveBackendLocalUrl ¶
Click to show internal directories.
Click to hide internal directories.