runmode

package
v0.2.10-3 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HttpPort = 8000
	GrpcPort = 50051
	Block    = true
	Project  = version.Project()

	IsDebug bool

	// DeviceID 主机设备ID
	DeviceID = version.DeviceID()

	// InstanceID service id
	InstanceID = version.InstanceID()

	Signal os.Signal = syscall.Signal(0)

	Version = version.Version()

	CommitID = version.CommitID()

	// Pwd 当前目录
	Pwd = assert.Exit1(os.Getwd())

	// Hostname 主机名
	Hostname = utils.FirstFnNotEmpty(
		func() string { return os.Getenv("HOSTNAME") },
		func() string { return assert.Exit1(os.Hostname()) },
	)

	// Namespace K8s命名空间
	Namespace = utils.FirstFnNotEmpty(
		func() string { return os.Getenv("NAMESPACE") },
		func() string { return os.Getenv("POD_NAMESPACE") },
		func() string {
			var file = "/var/run/secrets/kubernetes.io/serviceaccount/namespace"
			if pathutil.IsNotExist(file) {
				return ""
			}

			return strings.TrimSpace(string(assert.Exit1(ioutil.ReadFile(file))))
		},
	)
)

默认的全局配置

Functions

func GetVersion

func GetVersion() map[string]string

Types

This section is empty.

Jump to

Keyboard shortcuts

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