ichubconfig

package
v0.0.0-...-e3601d1 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2025 License: MulanPSL-2.0 Imports: 19 Imported by: 70

Documentation

Index

Constants

View Source
const (
	ConfigfileAppCommon  = "/config/app-common.yml"
	ConfigfileAppEnv     = "/config/app-env.yml"
	ConfigfileEnv        = "/config/env.yml"
	ConfigfileAppDefault = "/config/app.yml"
)

commonfilename

Variables

This section is empty.

Functions

func FindEnv

func FindEnv() string

func IfNotMaster

func IfNotMaster() bool

func LoadIchubConfig

func LoadIchubConfig() baseiface.ISingleton

Types

type IConfig

type IConfig interface {
	Read() *IchubConfig

	ReadMap(pathkey string) map[string]interface{}
	ReadVar(pathkey string) interface{}
	ReadInt(pathkey string) int
	ReadString(pathkey string) string
	ReadStruct(pathkey string, object interface{})

	RegisterEncDec(encdec baseiface.IEncDec) *IchubConfig

	ReadIchubDb() *baseconfig.DbClientDto
	ReadIchubDatasource() *baseconfig.DbClientDto
	ReadIchubMysql() *baseconfig.DbClientDto
	ReadIchubRpc() *baseconfig.RpcServerDto
	ReadIchubEs() *baseconfig.ElasticClientDto
	ReadIchubWebServer() (serverDto *baseconfig.WebServerDto)
	ReadIchubWebClient() (clientDto *baseconfig.WebClientDto)
	ReadWebSwagger() *baseconfig.SwaggerClientDto
}

type IchubConfig

type IchubConfig struct {
	configdto.IchubClientDto // 区分规则引擎, db和es引擎 WebClientType int

	Env      string `json:"env"`
	BasePath string `json:"base_path"`

	EnvConfigFile  string `json:"env_config_file"`
	ConfigFile     string `json:"config_file"`
	RealConfigFile string `json:"real_config_file"`
	Software       baseconfig.SoftwareDto
	Gocenter       baseconfig.GocenterDto `json:"gocenter"`

	Etcd struct {
		Server struct {
			Hosturl string `json:"hosturl"`
		}
	}

	Rpc struct {
		ServerName string `json:"server_name"`
		ServerPort int    `json:"server_port"`
		ClientName string `json:"-"`
	}

	Web struct {
		Server struct {
			Name string `json:"name"`
			Port int    `json:"port"`
		}

		Client     WebClient `json:"client"`
		Swagger    baseconfig.SwaggerClientDto
		Ruleclient WebClient `json:"ruleclient"`
		Dbclient   WebClient `json:"dbclient"`
		Esclient   WebClient `json:"esclient"`
	}

	Datasource struct {
		Dbtype string `json:"dbtype"`
		Dbname string `json:"dbname"`
		Host   string `json:"host"`
		Port   string `json:"port"`

		Username string `json:"username"`
		Password string `json:"password"`
		Sslmode  string `json:"sslmode"`
		Charset  string `json:"charset"`
	}

	Redis struct {
		Db       int    `json:"db"`
		Addr     string `json:"addr"`
		Password string `json:"password"`
	} `json:"redis"`

	Es struct {
		Url      string `json:"url"`
		Username string `json:"username,omitempty"`
		Password string `json:"password,omitempty"`
	}
	Mysql struct {
		Dbtype   string `json:"dbtype"`
		Dbname   string `json:"dbname"`
		Host     string `json:"host"`
		Port     string `json:"port"`
		Username string `json:"username"`
		Password string `json:"password"`
		Sslmode  string `json:"sslmode"`
		Charset  string `json:"charset"`
	}

	Gorm    baseconfig.GormClientDto
	Factroy baseconfig.FactroyClientDto
	Natscli baseconfig.NatsClientDto `json:"nats"`

	Gateway baseconfig.GatewayDto
	// contains filtered or unexported fields
}

func Default

func Default() *IchubConfig

func FindBeanIchubConfig

func FindBeanIchubConfig() *IchubConfig

func New

func New(configFile string) *IchubConfig

func NewIchubConfig

func NewIchubConfig() *IchubConfig

func (*IchubConfig) ChangeDbType

func (self *IchubConfig) ChangeDbType(dbtype string) string

func (*IchubConfig) CheckEnvFileExist

func (self *IchubConfig) CheckEnvFileExist() bool

func (*IchubConfig) CheckEnvFileExistEnv

func (self *IchubConfig) CheckEnvFileExistEnv() bool

func (*IchubConfig) CheckFileExist

func (self *IchubConfig) CheckFileExist() bool

func (*IchubConfig) EnvFileName

func (self *IchubConfig) EnvFileName() string

func (*IchubConfig) EnvFileNamePrev

func (self *IchubConfig) EnvFileNamePrev() string

func (*IchubConfig) FindEnv

func (self *IchubConfig) FindEnv() string

func (*IchubConfig) FullFileName

func (self *IchubConfig) FullFileName() string

func (*IchubConfig) IfMaster

func (self *IchubConfig) IfMaster() bool

func (*IchubConfig) Log

func (self *IchubConfig) Log()

func (*IchubConfig) LogFileName

func (self *IchubConfig) LogFileName()

func (*IchubConfig) ParseRealFileName

func (self *IchubConfig) ParseRealFileName() string

解析真正的环境文件名称

func (*IchubConfig) Read

func (self *IchubConfig) Read() *IchubConfig

func (*IchubConfig) ReadConfig

func (self *IchubConfig) ReadConfig(basePath string) error

func (*IchubConfig) ReadConfigBase

func (self *IchubConfig) ReadConfigBase(env ...string)

func (*IchubConfig) ReadConfigEnv

func (self *IchubConfig) ReadConfigEnv() string

func (*IchubConfig) ReadConfigFile

func (self *IchubConfig) ReadConfigFile() string

func (*IchubConfig) ReadDbWebClient

func (self *IchubConfig) ReadDbWebClient() (clientDto *baseconfig.WebClientDto)

func (*IchubConfig) ReadDefault

func (self *IchubConfig) ReadDefault() *IchubConfig

func (*IchubConfig) ReadDev

func (self *IchubConfig) ReadDev() *IchubConfig

func (*IchubConfig) ReadEnc

func (self *IchubConfig) ReadEnc() *IchubConfig

func (*IchubConfig) ReadEsWebClient

func (self *IchubConfig) ReadEsWebClient() (clientDto *baseconfig.WebClientDto)

func (*IchubConfig) ReadFactroy

func (self *IchubConfig) ReadFactroy() baseconfig.FactroyClientDto

func (*IchubConfig) ReadGateway

func (self *IchubConfig) ReadGateway() *baseconfig.GatewayDto

func (*IchubConfig) ReadGocenter

func (self *IchubConfig) ReadGocenter() *baseconfig.GocenterDto

func (*IchubConfig) ReadIchubCommon

func (self *IchubConfig) ReadIchubCommon() *IchubConfig

func (*IchubConfig) ReadIchubDatasource

func (self *IchubConfig) ReadIchubDatasource() *baseconfig.DbClientDto

func (*IchubConfig) ReadIchubDb

func (self *IchubConfig) ReadIchubDb() *baseconfig.DbClientDto

func (*IchubConfig) ReadIchubEs

func (self *IchubConfig) ReadIchubEs() *baseconfig.ElasticClientDto

func (*IchubConfig) ReadIchubFactroy

func (self *IchubConfig) ReadIchubFactroy() baseconfig.FactroyClientDto

func (*IchubConfig) ReadIchubGorm

func (self *IchubConfig) ReadIchubGorm() *baseconfig.GormClientDto

func (*IchubConfig) ReadIchubMysql

func (self *IchubConfig) ReadIchubMysql() *baseconfig.DbClientDto

func (*IchubConfig) ReadIchubRedis

func (self *IchubConfig) ReadIchubRedis() *baseconfig.RedisClientDto

func (*IchubConfig) ReadIchubRpc

func (self *IchubConfig) ReadIchubRpc() *baseconfig.RpcServerDto

func (*IchubConfig) ReadIchubWebClient

func (self *IchubConfig) ReadIchubWebClient() *baseconfig.WebClientDto

func (*IchubConfig) ReadIchubWebServer

func (self *IchubConfig) ReadIchubWebServer() *baseconfig.WebServerDto

func (*IchubConfig) ReadIf

func (self *IchubConfig) ReadIf() *IchubConfig

func (*IchubConfig) ReadInt

func (self *IchubConfig) ReadInt(pathkey string) int

func (*IchubConfig) ReadMap

func (self *IchubConfig) ReadMap(pathkey string) map[string]interface{}

func (*IchubConfig) ReadMapSlice

func (self *IchubConfig) ReadMapSlice(pathkey string) map[string][]string

func (*IchubConfig) ReadMaster

func (self *IchubConfig) ReadMaster() *IchubConfig

func (*IchubConfig) ReadNats

func (self *IchubConfig) ReadNats() *baseconfig.NatsClientDto

func (*IchubConfig) ReadRelease

func (self *IchubConfig) ReadRelease() *IchubConfig

func (*IchubConfig) ReadRuleClient

func (self *IchubConfig) ReadRuleClient() (clientDto *baseconfig.WebClientDto)

func (*IchubConfig) ReadString

func (self *IchubConfig) ReadString(pathkey string) string

func (*IchubConfig) ReadStringSlice

func (self *IchubConfig) ReadStringSlice(pathkey string) []string

func (*IchubConfig) ReadStruct

func (self *IchubConfig) ReadStruct(pathkey string, object interface{})

"key1.key"

func (*IchubConfig) ReadTest

func (self *IchubConfig) ReadTest() *IchubConfig

func (*IchubConfig) ReadVar

func (self *IchubConfig) ReadVar(pathkey string) interface{}

func (*IchubConfig) ReadVar2Rpc

func (self *IchubConfig) ReadVar2Rpc(key string) *baseconfig.RpcServerDto

func (*IchubConfig) ReadVar2WebClient

func (self *IchubConfig) ReadVar2WebClient(key string) *baseconfig.WebClientDto

func (*IchubConfig) ReadWebClient

func (self *IchubConfig) ReadWebClient() *baseconfig.WebClientDto

func (*IchubConfig) ReadWebServer

func (self *IchubConfig) ReadWebServer() *baseconfig.WebServerDto

func (*IchubConfig) ReadWebSwagger

func (self *IchubConfig) ReadWebSwagger() *baseconfig.SwaggerClientDto

func (*IchubConfig) RegisterEncDec

func (self *IchubConfig) RegisterEncDec(encdec baseiface.IEncDec) *IchubConfig

func (*IchubConfig) SetDefaultBasePath

func (self *IchubConfig) SetDefaultBasePath(basepath string)

func (*IchubConfig) SetOsEnv

func (self *IchubConfig) SetOsEnv(key, value string) *IchubConfig

func (*IchubConfig) Single

func (self *IchubConfig) Single() bool

func (*IchubConfig) ToEnc

func (self *IchubConfig) ToEnc() *IchubConfig

func (*IchubConfig) ToEncString

func (self *IchubConfig) ToEncString() string

type WebClient

type WebClient struct {
	Name          string `json:"name"`
	TestUrl       string `json:"test_url"`
	EnableTestUrl string `json:"-"`
	WebTimeout    string `json:"web_timeout"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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