config

package
v1.17.0-tls Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DtmMetricsPort is metric port
	DtmMetricsPort = 8889
	// Mysql is mysql driver
	Mysql = "mysql"
	// Redis is redis driver
	Redis = "redis"
	// BoltDb is boltdb driver
	BoltDb = "boltdb"
	// Postgres is postgres driver
	Postgres = "postgres"
)

Variables

View Source
var Config = Type{}

Config config

Functions

func MustLoadConfig

func MustLoadConfig(confFile string)

MustLoadConfig load config from env and file

Types

type HTTPMicroService

type HTTPMicroService struct {
	Driver          string `yaml:"Driver" default:"default"`
	RegistryType    string `yaml:"RegistryType" default:""`
	RegistryAddress string `yaml:"RegistryAddress" default:""`
	RegistryOptions string `yaml:"RegistryOptions" default:"{}"`
	Target          string `yaml:"Target"`
	EndPoint        string `yaml:"EndPoint"`
}

HTTPMicroService is the config type for microservice based on http, like springcloud

type Log

type Log struct {
	Outputs            string `yaml:"Outputs" default:"stderr"`
	RotationEnable     int64  `yaml:"RotationEnable" default:"0"`
	RotationConfigJSON string `yaml:"RotationConfigJSON" default:"{}"`
}

Log config customize log

type MicroService

type MicroService struct {
	Driver   string `yaml:"Driver" default:"default"`
	Target   string `yaml:"Target"`
	EndPoint string `yaml:"EndPoint"`
}

MicroService config type for microservice based grpc

type Store

type Store struct {
	Driver             string `yaml:"Driver" default:"boltdb"`
	Host               string `yaml:"Host"`
	Port               int64  `yaml:"Port"`
	User               string `yaml:"User"`
	Password           string `yaml:"Password"`
	Db                 string `yaml:"Db" default:"dtm"`
	Schema             string `yaml:"Schema" default:"public"`
	MaxOpenConns       int64  `yaml:"MaxOpenConns" default:"500"`
	MaxIdleConns       int64  `yaml:"MaxIdleConns" default:"500"`
	ConnMaxLifeTime    int64  `yaml:"ConnMaxLifeTime" default:"5"`
	DataExpire         int64  `yaml:"DataExpire" default:"604800"`        // Trans data will expire in 7 days. only for redis/boltdb.
	FinishedDataExpire int64  `yaml:"FinishedDataExpire" default:"86400"` // finished Trans data will expire in 1 days. only for redis.
	RedisPrefix        string `yaml:"RedisPrefix" default:"{a}"`          // Redis storage prefix. store data to only one slot in cluster
}

Store defines storage relevant info

func (*Store) GetDBConf

func (s *Store) GetDBConf() dtmcli.DBConf

GetDBConf returns db conf info

func (*Store) IsDB

func (s *Store) IsDB() bool

IsDB checks config driver is mysql or postgres

type Type

type Type struct {
	Store                         Store            `yaml:"Store"`
	TransCronInterval             int64            `yaml:"TransCronInterval" default:"3"`
	TimeoutToFail                 int64            `yaml:"TimeoutToFail" default:"35"`
	RetryInterval                 int64            `yaml:"RetryInterval" default:"10"`
	RequestTimeout                int64            `yaml:"RequestTimeout" default:"3"`
	HTTPPort                      int64            `yaml:"HttpPort" default:"36789"`
	GrpcPort                      int64            `yaml:"GrpcPort" default:"36790"`
	JSONRPCPort                   int64            `yaml:"JsonRpcPort" default:"36791"`
	MicroService                  MicroService     `yaml:"MicroService"`
	HTTPMicroService              HTTPMicroService `yaml:"HttpMicroService"`
	UpdateBranchSync              int64            `yaml:"UpdateBranchSync"`
	UpdateBranchAsyncGoroutineNum int64            `yaml:"UpdateBranchAsyncGoroutineNum" default:"1"`
	LogLevel                      string           `yaml:"LogLevel" default:"info"`
	Log                           Log              `yaml:"Log"`
	TimeZoneOffset                string           `yaml:"TimeZoneOffset"`
	ConfigUpdateInterval          int64            `yaml:"ConfigUpdateInterval" default:"3"`
	AlertRetryLimit               int64            `yaml:"AlertRetryLimit" default:"3"`
	AlertWebHook                  string           `yaml:"AlertWebHook"`
	AdminBasePath                 string           `yaml:"AdminBasePath"`
}

Type is the type for the config of dtm server

Jump to

Keyboard shortcuts

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