config

package
v0.0.0-...-bfe6062 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// EnvPrefix 是 GAM 環境變數的前墬
	EnvPrefix string
)

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	Env       string
	Mode      string
	Logs      []LogSetting
	Databases []Database
	Temporal  struct {
		Address string
	}
	Redis struct {
		ClusterMode     bool     `yaml:"cluster_mode"`
		Addresses       []string `yaml:"addresses"`
		Password        string   `yaml:"password"`
		MaxRetries      int      `yaml:"max_retries"`
		PoolSizePerNode int      `yaml:"pool_size_per_node"`
		DB              int      `yaml:"db"`
	}
	Jaeger struct {
		AdvertiseAddr string `yaml:"advertise_addr"`
	}
	BFF struct {
		HTTPBind          string `yaml:"http_bind"`
		HTTPAdvertiseAddr string `yaml:"http_advertise_addr"`
	}
	Event struct {
		GRPCBind          string `yaml:"grpc_bind"`
		GRPCAdvertiseAddr string `yaml:"grpc_advertise_addr"`
	}
	Wallet struct {
		GRPCBind          string `yaml:"grpc_bind"`
		GRPCAdvertiseAddr string `yaml:"grpc_advertise_addr"`
	}
	// contains filtered or unexported fields
}

Configuration 用來代表 config 設定物件

func New

func New(fileName string) Configuration

New function 創建一個 configuration instance 出來

func (Configuration) InitDatabase

func (cfg Configuration) InitDatabase(name string) (*gorm.DB, error)

func (Configuration) InitLogger

func (cfg Configuration) InitLogger(appID string)

func (Configuration) InitTracer

func (cfg Configuration) InitTracer(appID string) func()

InitTracer creates a new trace provider instance and registers it as global trace provider.

func (Configuration) Path

func (cfg Configuration) Path(path ...string) string

type Database

type Database struct {
	Name       string
	Username   string
	Password   string
	Address    string
	DBName     string
	Type       string
	IsMigrated bool `yaml:"is_migrated"`
}

Database 用來提供連線的資料庫數據

type LogSetting

type LogSetting struct {
	Name             string `yaml:"name"`
	Type             string `yaml:"type"`
	MinLevel         string `yaml:"min_level"`
	ConnectionString string `yaml:"connection_string"`
}

LogSetting 用來設定 log 相關資訊

Jump to

Keyboard shortcuts

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