provider

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2021 License: MIT Imports: 37 Imported by: 0

Documentation

Index

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

func (c CompletedConfig) Apply(ctx context.Context) error

Apply set options and something else as global init, act likes New but without Config's instance Apply usually called after Complete

func (CompletedConfig) New

func (c CompletedConfig) New(ctx context.Context) (*Provider, error)

New creates a new server which logically combines the handling chain with the passed server. name is used to differentiate for logging. The handler chain in particular can be difficult as it starts delgating. New 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 NewConfig

func NewConfig() *Config

NewConfig returns a Config struct with the default values

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) Context

func (p *Provider) Context() context.Context

func (*Provider) GetBackendAdvertiseHostPort

func (p *Provider) GetBackendAdvertiseHostPort() string

func (*Provider) GetBackendBindHostPort

func (p *Provider) GetBackendBindHostPort() string

func (*Provider) GetBackendServeHostPort

func (p *Provider) GetBackendServeHostPort() string

func (*Provider) GetCORS

func (p *Provider) GetCORS() gin.HandlerFunc

func (*Provider) HTTPScheme

func (p *Provider) HTTPScheme() string

func (*Provider) KeyCipher

func (p *Provider) KeyCipher() *pasta.Pasta

func (*Provider) Proto

func (p *Provider) Proto() *viper_.ViperProto

func (*Provider) ReloadForever added in v0.0.13

func (p *Provider) ReloadForever()

func (*Provider) ResolveBackendLocalUrl

func (p *Provider) ResolveBackendLocalUrl(relativePaths ...string) string

func (*Provider) SqlDB

func (p *Provider) SqlDB() *sqlx.DB

func (*Provider) SqlDBPing

func (p *Provider) SqlDBPing() error

Jump to

Keyboard shortcuts

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