vconfig

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitConfig

func InitConfig() (err error)

InitConfig init config

func InitConfigEmbed

func InitConfigEmbed(fs embed.FS) (err error)

InitConfigEmbed init config

func NewConfig

func NewConfig[T any](conf *T) (config *T, err error)

NewConfig new config

func SetConfigPath

func SetConfigPath(confPath string)

SetConfigPath set config path

func SetConfigType

func SetConfigType(confType string)

SetConfigType set config type

func Unmarshal

func Unmarshal(rawVal interface{}, opts ...DecoderConfigOption) error

Types

type Api

type Api struct {
	Secret string `mapstructure:",omitempty"`
}

func (Api) String

func (a Api) String() (data string)

type App

type App struct {
	Env  string `mapstructure:",omitempty"`
	Name string `mapstructure:",omitempty"`
}

type Config

type Config struct {
	Api             Api
	App             App
	Es              *ves.Options
	HttpServer      HttpServer
	Log             *vlog.Options
	Metric          *vmetric.Options
	Mongodb         *vmongodb.Options
	Mysql           *vmysql.Options
	Redis           *redis.UniversalOptions
	TcpServer       vtcp.Server
	WebsocketServer vwebsocket.Server
}

func (*Config) GetEs

func (c *Config) GetEs() *ves.Options

func (*Config) GetHttpServer

func (c *Config) GetHttpServer() HttpServer

func (*Config) GetLog

func (c *Config) GetLog() *vlog.Options

func (*Config) GetMetric

func (c *Config) GetMetric() *vmetric.Options

func (*Config) GetMongodb

func (c *Config) GetMongodb() *vmongodb.Options

func (*Config) GetMysql

func (c *Config) GetMysql() *vmysql.Options

func (*Config) GetRedis

func (c *Config) GetRedis() *redis.UniversalOptions

func (*Config) GetTcpServer

func (c *Config) GetTcpServer() vtcp.Server

func (*Config) GetWebsocketServer

func (c *Config) GetWebsocketServer() vwebsocket.Server

type DecoderConfigOption

type DecoderConfigOption = viper.DecoderConfigOption

type HttpServer

type HttpServer struct {
	Address string `mapstructure:",omitempty"`
	Model   string `mapstructure:",omitempty"`
}

type IConfig

type IConfig interface {
	GetEs() *ves.Options
	GetHttpServer() HttpServer
	GetLog() *vlog.Options
	GetMetric() *vmetric.Options
	GetMongodb() *vmongodb.Options
	GetMysql() *vmysql.Options
	GetRedis() *redis.UniversalOptions
	GetTcpServer() vtcp.Server
	GetWebsocketServer() vwebsocket.Server
}

Jump to

Keyboard shortcuts

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