config

package
v0.0.0-...-853dba6 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: GPL-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package config config struct definition

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateLogger

func CreateLogger(filename string) (log.Logger, error)

CreateLogger 创建日志句柄

func CreateLoggers

func CreateLoggers(fpath string, names []string) ([]log.Logger, error)

CreateLoggers 批量创建Logger

func CreateLogrusLogger

func CreateLogrusLogger(filename string) (*logrus.Logger, error)

CreateLogrusLogger 创建Logrus日志句柄

Types

type ApplicationConfig

type ApplicationConfig struct {
	Global struct {
		Logpath string
		Debug   bool
		Loggers struct {
			AppLogger    log.Logger
			SQLLogger    log.Logger
			DomainLogger log.Logger
		}
		// 应用名
		App string
		// 用户管理模式
		User struct {
			// 用户默认收藏
			DefaultFavorites string
			// 账号类型(支持:Userpassword)
			AccountType string
			// Userpassword 登录使用的会话 JWT
			JWTSecret        string
			JWTHeadKey       string
			JWTExpireMinutes int
			// 用户头像地址
			UserPhotoURL string
			// 用户登录跳转页面
			LoginURL string
			// 黑名单
			Blacklist []string
		}
		// 缓存模块是否开启
		Cache struct {
			InstanceOpen bool
		}
	}
	Resource struct {
		// 业务数据库
		MetaDB       config.AccessPoint `json:"metadb" yaml:"metadb"`
		ClickhouseDB ClickhouseConfig   `yaml:"clickhouse_db"`
		// 系统基础信息指标队列
		SysInfoMq     ConsumerMq         `yaml:"sys_info_mq"`
		InstanceCache config.AccessPoint `yaml:"redis_cache"`
		Lock          config.AccessPoint `json:"lock" yaml:"redis_lock"`
	}
	Dependence struct {
		// ETL-msg
		Metrics config.AccessPoint `yaml:"metrics"`
	}
	Application struct {
		Gateway struct {
			MaxConnection int
		}
		Stream struct {
			MaxConnection  int
			BatchStoreSize int                  `json:"batch_store_size" yaml:"batch_store_size"`
			SysInfo        config.CronPoint     `yaml:"sys_info"`
			MonitorSweeper MonitorSweeperConfig `yaml:"monitor_sweeper"`
		}
	}
}

ApplicationConfig application config

func DefaultApplicationConfig

func DefaultApplicationConfig() ApplicationConfig

DefaultApplicationConfig new default config

func (*ApplicationConfig) LoadEntity

func (app *ApplicationConfig) LoadEntity() (*ApplicationEntity, error)

LoadEntity ....

func (*ApplicationConfig) OpenClickhouse

func (app *ApplicationConfig) OpenClickhouse(conf *ClickhouseConfig) (driver.Conn, error)

OpenClickhouse ...

type ApplicationEntity

type ApplicationEntity struct {
	Logger struct {
		WebLogger     log.Logger
		RobotLogger   log.Logger
		SQLLogger     log.Logger
		GeneralLogger log.Logger
		StreamLogger  log.Logger
	}
	Global struct {
		Debug          bool
		TemplatesPath  string
		ConfigFilePath string
		LogsPath       string
	}
	Resource struct {
		MetaDB   *database.DBClient
		Lock     lock.Lock
		CkClient driver.Conn
		// 系统基础信息指标队列
		SysInfoMq mq.MessageQueue
	}
}

ApplicationEntity application entity

type ClickhouseConfig

type ClickhouseConfig struct {
	config.AccessPoint `yaml:",inline"`
	MaxOpenConn        int  `yaml:"max_open_conn"`
	MaxIdleConn        int  `yaml:"max_idle_conn"`
	Distributed        bool `yaml:"distributed"`
	Debug              bool `yaml:"debug"`
	MaxExecutionTime   int  `yaml:"max_execution_time"`
}

ClickhouseConfig clickhouse配置

type ConsumerMq

type ConsumerMq struct {
	config.AccessPoint `yaml:",inline"`
	ConsumerNum        int `yaml:"consumer_num"`
}

ConsumerMq 采集数据mq配置

type GlobalConfiguration

type GlobalConfiguration struct {
	GatewayYaml trpc.TrpcYaml `json:"trpc.gateway" type:"string"`
	Application trpc.TrpcYaml `json:"application" type:"yaml"`
}

GlobalConfiguration 全局配置

func LoadGlobalConfigurationFromLocalfile

func LoadGlobalConfigurationFromLocalfile(appfile string) (*GlobalConfiguration, error)

LoadGlobalConfigurationFromLocalfile load from local file

func (*GlobalConfiguration) LoadApplication

func (gc *GlobalConfiguration) LoadApplication() (*ApplicationConfig, error)

LoadApplication loadconfig from string

type MonitorSweeperConfig

type MonitorSweeperConfig struct {
	Enable            bool `yaml:"enable"`
	IntervalSec       int  `yaml:"interval_sec"`
	OfflineTimeoutSec int  `yaml:"offline_timeout_sec"`
	BatchSize         int  `yaml:"batch_size"`
}

MonitorSweeperConfig os_monitor 离线扫描配置。

Jump to

Keyboard shortcuts

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