config

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0, MIT Imports: 10 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Client custom http client
	Client *http.Client

	HttpURL     string        `` /* 133-byte string literal not displayed */
	HTTPTimeout time.Duration `` /* 133-byte string literal not displayed */
	AppKey      string        `` /* 127-byte string literal not displayed */
	AppSecret   string        `` /* 145-byte string literal not displayed */
	AccessToken string        `` /* 157-byte string literal not displayed */
	TradeUrl    string        `` /* 139-byte string literal not displayed */
	QuoteUrl    string        `` /* 139-byte string literal not displayed */

	LogLevel string `` /* 139-byte string literal not displayed */

	// longbridge protocol config
	AuthTimeout    time.Duration `` /* 157-byte string literal not displayed */
	Timeout        time.Duration `` /* 127-byte string literal not displayed */
	WriteQueueSize int           `` /* 181-byte string literal not displayed */
	ReadQueueSize  int           `` /* 175-byte string literal not displayed */
	ReadBufferSize int           `` /* 181-byte string literal not displayed */
	MinGzipSize    int           `` /* 163-byte string literal not displayed */
	Region         Region        `env:"LONGPORT_REGION" yaml:"LONGPORT_REGION" toml:"LONGPORT_REGION"`
	// contains filtered or unexported fields
}

Config store Longbridge config

func New

func New(opts ...Option) (configData *Config, err error)

func NewFormEnv deprecated

func NewFormEnv() (*Config, error)

Deprecated: NewFormEnv to create config with enviromente variables

func (*Config) Logger

func (c *Config) Logger() log.Logger

func (*Config) SetLogger

func (c *Config) SetLogger(l log.Logger)

type ConfigType

type ConfigType string
const (
	ConfigTypeEnv  ConfigType = ".env"
	ConfigTypeYAML ConfigType = ".yaml"
	ConfigTypeTOML ConfigType = ".toml"
)

type EnvConfig

type EnvConfig struct {
}

func (*EnvConfig) GetConfig

func (c *EnvConfig) GetConfig(_ *Options) (data *Config, err error)

type IConfig

type IConfig interface {
	GetConfig(opts *Options) (*Config, error)
}

type Option

type Option func(*Options)

func WithConfigKey added in v0.9.2

func WithConfigKey(appKey string, appSecret string, accessToken string) Option

WithConfigKey config appKey, appSecret, accessToken

func WithFilePath

func WithFilePath(filePath string) Option

WithFilePath config path

type Options

type Options struct {
	// contains filtered or unexported fields
}

type Region added in v0.9.1

type Region string
var (
	RegionCN Region = "cn"
)

type TOMLConfig

type TOMLConfig struct {
}

func (*TOMLConfig) GetConfig

func (c *TOMLConfig) GetConfig(opts *Options) (data *Config, err error)

type YAMLConfig

type YAMLConfig struct {
}

func (*YAMLConfig) GetConfig

func (c *YAMLConfig) GetConfig(opts *Options) (data *Config, err error)

Jump to

Keyboard shortcuts

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