config

package
v1.8.4 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2025 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FlagConf          = "config_folder_path"
	FlagTransferIndex = "index"
)

Variables

View Source
var (
	//go:embed version
	Version string
	//go:embed template.xlsx
	ImportTemplate []byte
)
View Source
var (
	ShareFileName           = "share.yml"
	RedisConfigFileName     = "redis.yml"
	DiscoveryConfigFileName = "discovery.yml"
	MongodbConfigFileName   = "mongodb.yml"
	LogConfigFileName       = "log.yml"
	ChatAPIAdminCfgFileName = "chat-api-admin.yml"
	ChatAPIChatCfgFileName  = "chat-api-chat.yml"
	ChatRPCAdminCfgFileName = "chat-rpc-admin.yml"
	ChatRPCChatCfgFileName  = "chat-rpc-chat.yml"
)
View Source
var EnvPrefixMap map[string]string

Functions

func Load added in v1.8.4

func Load(configDirectory string, configFileName string, envPrefix string, runtimeEnv string, config any) error

Types

type API

type API struct {
	Api struct {
		ListenIP string `mapstructure:"listenIP"`
		Ports    []int  `mapstructure:"ports"`
	} `mapstructure:"api"`
}

type Admin

type Admin struct {
	RPC struct {
		RegisterIP string `mapstructure:"registerIP"`
		ListenIP   string `mapstructure:"listenIP"`
		Ports      []int  `mapstructure:"ports"`
	} `mapstructure:"rpc"`
	TokenPolicy struct {
		Expire int `mapstructure:"expire"`
	} `mapstructure:"tokenPolicy"`
	Secret string `mapstructure:"secret"`
}

type AllConfig added in v1.8.4

type AllConfig struct {
	AdminAPI  API
	ChatAPI   API
	Admin     Admin
	Chat      Chat
	Discovery Discovery
	Log       Log
	Mongo     Mongo
	Redis     Redis
	Share     Share
}

func (*AllConfig) GetConfigNames added in v1.8.4

func (a *AllConfig) GetConfigNames() []string

func (*AllConfig) Name2Config added in v1.8.4

func (a *AllConfig) Name2Config(name string) any

type Chat

type Chat struct {
	RPC struct {
		RegisterIP string `mapstructure:"registerIP"`
		ListenIP   string `mapstructure:"listenIP"`
		Ports      []int  `mapstructure:"ports"`
	} `mapstructure:"rpc"`
	VerifyCode struct {
		ValidTime  int    `mapstructure:"validTime"`
		ValidCount int    `mapstructure:"validCount"`
		UintTime   int    `mapstructure:"uintTime"`
		MaxCount   int    `mapstructure:"maxCount"`
		SuperCode  string `mapstructure:"superCode"`
		Len        int    `mapstructure:"len"`
		Phone      struct {
			Use string `mapstructure:"use"`
			Ali struct {
				Endpoint                     string `mapstructure:"endpoint"`
				AccessKeyID                  string `mapstructure:"accessKeyId"`
				AccessKeySecret              string `mapstructure:"accessKeySecret"`
				SignName                     string `mapstructure:"signName"`
				VerificationCodeTemplateCode string `mapstructure:"verificationCodeTemplateCode"`
			} `mapstructure:"ali"`
		} `mapstructure:"phone"`
		Mail struct {
			Enable                  bool   `mapstructure:"enable"`
			Title                   string `mapstructure:"title"`
			SenderMail              string `mapstructure:"senderMail"`
			SenderAuthorizationCode string `mapstructure:"senderAuthorizationCode"`
			SMTPAddr                string `mapstructure:"smtpAddr"`
			SMTPPort                int    `mapstructure:"smtpPort"`
		} `mapstructure:"mail"`
	} `mapstructure:"verifyCode"`
	LiveKit struct {
		URL    string `mapstructure:"url"`
		Key    string `mapstructure:"key"`
		Secret string `mapstructure:"secret"`
	} `mapstructure:"liveKit"`
	AllowRegister bool `mapstructure:"allowRegister"`
}

type Discovery added in v1.8.0

type Discovery struct {
	Enable     string     `mapstructure:"enable"`
	Etcd       Etcd       `mapstructure:"etcd"`
	Kubernetes Kubernetes `mapstructure:"kubernetes"`
	RpcService RpcService `mapstructure:"rpcService"`
}

type Etcd added in v1.8.0

type Etcd struct {
	RootDirectory string   `mapstructure:"rootDirectory"`
	Address       []string `mapstructure:"address"`
	Username      string   `mapstructure:"username"`
	Password      string   `mapstructure:"password"`
}

type Kubernetes added in v1.8.4

type Kubernetes struct {
	Namespace string `mapstructure:"namespace"`
}

type Log

type Log struct {
	StorageLocation     string `mapstructure:"storageLocation"`
	RotationTime        uint   `mapstructure:"rotationTime"`
	RemainRotationCount uint   `mapstructure:"remainRotationCount"`
	RemainLogLevel      int    `mapstructure:"remainLogLevel"`
	IsStdout            bool   `mapstructure:"isStdout"`
	IsJson              bool   `mapstructure:"isJson"`
	IsSimplify          bool   `mapstructure:"isSimplify"`
	WithStack           bool   `mapstructure:"withStack"`
}

type Mongo

type Mongo struct {
	URI         string   `mapstructure:"uri"`
	Address     []string `mapstructure:"address"`
	Database    string   `mapstructure:"database"`
	Username    string   `mapstructure:"username"`
	Password    string   `mapstructure:"password"`
	AuthSource  string   `mapstructure:"authSource"`
	MaxPoolSize int      `mapstructure:"maxPoolSize"`
	MaxRetry    int      `mapstructure:"maxRetry"`
}

func (*Mongo) Build

func (m *Mongo) Build() *mongoutil.Config

type Redis

type Redis struct {
	Address        []string `mapstructure:"address"`
	Username       string   `mapstructure:"username"`
	Password       string   `mapstructure:"password"`
	EnablePipeline bool     `mapstructure:"enablePipeline"`
	ClusterMode    bool     `mapstructure:"clusterMode"`
	DB             int      `mapstructure:"db"`
	MaxRetry       int      `mapstructure:"MaxRetry"`
}

func (*Redis) Build

func (r *Redis) Build() *redisutil.Config

type RpcService added in v1.8.4

type RpcService struct {
	Chat  string `mapstructure:"chat"`
	Admin string `mapstructure:"admin"`
}

func (*RpcService) GetServiceNames added in v1.8.4

func (r *RpcService) GetServiceNames() []string

type Share

type Share struct {
	OpenIM struct {
		ApiURL      string `mapstructure:"apiURL"`
		Secret      string `mapstructure:"secret"`
		AdminUserID string `mapstructure:"adminUserID"`
	} `mapstructure:"openIM"`
	ChatAdmin   []string `mapstructure:"chatAdmin"`
	ProxyHeader string   `mapstructure:"proxyHeader"`
}

Jump to

Keyboard shortcuts

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