util

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Flags flags
View Source
var Logger *log_level.Logger

Functions

func GenHash

func GenHash(str ...string) string

func GetErrCode

func GetErrCode(err error) *int

func GetStatusCode

func GetStatusCode(err error) int

func InitLogger

func InitLogger(c LoggerConfig) (out *os.File, err error)

func ParseFlags

func ParseFlags()

Types

type Config

type Config struct {
	Logger            LoggerConfig      `json:"logger" env_var:"LOGGER_CONFIG"`
	Socket            SocketConfig      `json:"socket" env_var:"SOCKET_CONFIG"`
	Jobs              JobsConfig        `json:"jobs" env_var:"JOBS_CONFIG"`
	CoreService       CoreServiceConfig `json:"core_service" env_var:"CORE_SERVICE_CONFIG"`
	HttpClient        HttpClientConfig  `json:"http_client" env_var:"HTTP_CLIENT_CONFIG"`
	Kratos            KratosConfig      `json:"kratos" env_var:"KRATOS_CONFIG"`
	EndpointsConfPath string            `json:"endpoints_conf_path" env_var:"ENDPOINTS_CONF_PATH"`
	ComposeFilePath   string            `json:"compose_file_path" env_var:"COMPOSE_FILE_PATH"`
	CoreID            string            `json:"core_id" env_var:"CORE_ID"`
	ImgPurgeDelay     int64             `json:"img_purge_delay" env_var:"IMG_PURGE_DELAY"`
	LogHandler        LogHandlerConfig  `json:"log_handler" env_var:"LOG_HANDLER_CONFIG"`
}

func NewConfig

func NewConfig(path string) (*Config, error)

type CoreServiceConfig added in v0.0.2

type CoreServiceConfig struct {
	GatewaySrvName string `json:"gateway_srv_name" env_var:"CORE_GATEWAY_SRV_NAME"`
}

type HttpClientConfig added in v0.0.2

type HttpClientConfig struct {
	CewSocketPath string `json:"cew_socket_path" env_var:"CEW_SOCKET_PATH"`
	Timeout       int64  `json:"timeout" env_var:"HTTP_TIMEOUT"`
}

type JobsConfig

type JobsConfig struct {
	BufferSize  int   `json:"buffer_size" env_var:"JOBS_BUFFER_SIZE"`
	MaxNumber   int   `json:"max_number" env_var:"JOBS_MAX_NUMBER"`
	CCHInterval int   `json:"cch_interval" env_var:"JOBS_CCH_INTERVAL"`
	JHInterval  int   `json:"jh_interval" env_var:"JOBS_JH_INTERVAL"`
	PJHInterval int64 `json:"pjh_interval" env_var:"JOBS_PJH_INTERVAL"`
	MaxAge      int64 `json:"max_age" env_var:"JOBS_MAX_AGE"`
}

type KratosConfig added in v0.12.0

type KratosConfig struct {
	Version      string `json:"version" env_var:"KRATOS_VERSION"`
	ConfigPath   string `json:"config_path" env_var:"KRATOS_CONFIG_PATH"`
	SecretLength int    `json:"secret_length" env_var:"KRATOS_SECRET_LENGTH"`
	SecretMaxAge int64  `json:"secret_max_age" env_var:"KRATOS_SECRET_MAX_AGE"`
	Interval     int64  `json:"interval" env_var:"KRATOS_INTERVAL"`
}

type LogHandlerConfig added in v0.14.1

type LogHandlerConfig struct {
	Path       string `json:"path" env_var:"LOG_HANDLER_PATH"`
	BufferSize int    `json:"buffer_size" env_var:"LOG_HANDLER_BUFFER_SIZE"`
}

type LoggerConfig added in v0.11.1

type LoggerConfig struct {
	Level        level.Level `json:"level" env_var:"LOGGER_LEVEL"`
	Utc          bool        `json:"utc" env_var:"LOGGER_UTC"`
	Path         string      `json:"path" env_var:"LOGGER_PATH"`
	FileName     string      `json:"file_name" env_var:"LOGGER_FILE_NAME"`
	Terminal     bool        `json:"terminal" env_var:"LOGGER_TERMINAL"`
	Microseconds bool        `json:"microseconds" env_var:"LOGGER_MICROSECONDS"`
	Prefix       string      `json:"prefix" env_var:"LOGGER_PREFIX"`
}

type SocketConfig

type SocketConfig struct {
	Path     string      `json:"path" env_var:"SOCKET_PATH"`
	GroupID  int         `json:"group_id" env_var:"SOCKET_GROUP_ID"`
	FileMode fs.FileMode `json:"file_mode" env_var:"SOCKET_FILE_MODE"`
}

Jump to

Keyboard shortcuts

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