config

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package config 配置模块,由程序入口加载,全局可用

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestSetup

func TestSetup()

TestSetup 工具函数,用于初始化 config 测试环境

func TestTeardown

func TestTeardown()

TestTeardown 工具函数,测试完成后对 config 进行清理

Types

type Database

type Database struct {
	Driver   string `json:"driver" yaml:"driver"`
	Name     string `json:"name" yaml:"name"`
	Username string `json:"username" yaml:"username"`
	Password string `json:"password" yaml:"password"`
	Host     string `json:"host" yaml:"host"`
	Port     int    `json:"port" yaml:"port"`
}

type Datatunnel

type Datatunnel struct {
	ExportServices map[string]string `json:"export_services" yaml:"export_services"`
}

func (*Datatunnel) GetAddr

func (t *Datatunnel) GetAddr(serviceName string) (addr string, ok bool)

func (*Datatunnel) GetPort added in v1.9.1

func (t *Datatunnel) GetPort(serviceName string) (port int, ok bool)

type Extension added in v1.9.1

type Extension struct {
	GRPCPort int `json:"grpc_port" yaml:"grpc_port"`
}

func (Extension) GRPCAddress added in v1.9.1

func (e Extension) GRPCAddress() string

type Options

type Options struct {
	Debug          bool           `json:"debug" yaml:"debug"`
	SmartCloud     SmartCloud     `json:"smartcloud" yaml:"smartcloud"`
	SmartAssistant SmartAssistant `json:"smartassistant" yaml:"smartassistant"`
	Datatunnel     Datatunnel     `json:"datatunnel" yaml:"datatunnel"`
	Extension      Extension      `json:"extension" yaml:"extension"`
}

func GetConf

func GetConf() *Options

func InitConfig

func InitConfig(fn string) *Options

type SmartAssistant

type SmartAssistant struct {
	ID             string   `json:"id" yaml:"id"`
	Key            string   `json:"key" yaml:"key"`
	Db             string   `json:"db" yaml:"db"`
	Host           string   `json:"host" yaml:"host"`
	Port           int      `json:"port" yaml:"port"`
	GRPCPort       int      `json:"grpc_port" yaml:"grpc_port"`
	FluentdAddress string   `json:"fluentd_address" yaml:"fluentd_address"`
	Database       Database `json:"database" yaml:"database"`
	// HostDataPath 宿主机runtime目录
	HostRuntimePath string `json:"host_runtime_path" yaml:"host_runtime_path"`
	RuntimePath     string `json:"runtime_path" yaml:"runtime_path"`

	DockerRegistry string `json:"docker_registry" yaml:"docker_registry"`

	// Deprecated: HostIP 插件取消host模式后删除
	HostIP string `json:"host_ip" yaml:"host_ip"`
}

func (SmartAssistant) BackupPath

func (sa SmartAssistant) BackupPath() string

func (SmartAssistant) DataPath

func (sa SmartAssistant) DataPath() string

func (SmartAssistant) GRPCAddress

func (sa SmartAssistant) GRPCAddress() string

func (SmartAssistant) HttpAddress

func (sa SmartAssistant) HttpAddress() string

type SmartCloud

type SmartCloud struct {
	Domain       string `json:"domain" yaml:"domain"`
	TLS          bool   `json:"tls" yaml:"tls"`
	GRPCPort     int    `json:"grpc_port" yaml:"grpc_port"`
	DataCenterID int    `json:"data_center_id"`
	WorkerID     int    `json:"worker_id"`
}

func (SmartCloud) URL

func (sc SmartCloud) URL() string

func (SmartCloud) WebsocketURL

func (sc SmartCloud) WebsocketURL() string

Jump to

Keyboard shortcuts

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