host

package
v0.0.0-...-418145e Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FrameworkVersion = "1.0.0"

	HostEnvironment_Windows    = "windows"
	HostEnvironment_Linux      = "linux"
	HostEnvironment_Supervisor = "supervisor"
	HostEnvironment_Docker     = "docker"
	HostEnvironment_Systemd    = "systemd"
	HostEnvironment_Other      = "other"
)
View Source
const (
	ENV_ConsulPath = "app.abmpconsul.path"
	ENV_Product    = "app.product"
	ENV_AppName    = "app.name"
	//应用运行目录
	ENV_Path = "app.path"
	//应用名称
	ENV_FileName     = "app.filename"
	ENV_IsHostInABMP = "app.isHostInABMP"
	ENV_Description  = "app.description"
	ENV_StartTime    = "app.startTime"
	//启动app消耗的时间
	ENV_StartInterval = "app.startInterval"
	ENV_AppVersion    = "app.appVersion"
	//abmp框架版本
	ENV_FrameworkVersion = "app.frameworkVersion"
	//应用的运行环境meta key,值主要有windows,linux,supervisor,docker,systemd,other
	ENV_HostEnvironment = "app.hostEnvironment"
	ENV_HTTP            = "app.http"
	//公告主机地址
	ENV_AdvertiseHost = "app.advertiseHost"
	//健康检查的地址
	ENV_Healthcheck = "app.healthcheck"

	ENV_Plugininstaller_sourceUrl = "plugininstaller_sourceUrl"
	ENV_Plugininstaller_feedName  = "plugininstaller_feedName"
	ENV_Plugininstaller_apiKey    = "plugininstaller_apiKey"
)

常用的环境变量

Variables

This section is empty.

Functions

func IsEnvKey

func IsEnvKey(key string) bool

获取指定的key是否是内置的key

Types

type GOOS_OS

type GOOS_OS string

func (GOOS_OS) IsLinux

func (os GOOS_OS) IsLinux() bool

func (GOOS_OS) IsWindows

func (os GOOS_OS) IsWindows() bool

type IHostEnvironment

type IHostEnvironment interface {
	GetOS() GOOS_OS
	GetCurrentPath() string
	GetExecFileName() string
	SetProduct(product string)
	SetAppName(appName string)
	SetAppVersion(appVersion string)
	GetHttp() string
	SetHttp(http string)

	SetEnv(key string, value interface{})
	GetEnv(key string) interface{}
	GetEnvString(key string) string

	//设置os环境 变量
	SetOSEnv(key string, value string)
	AllKey() []string
}

func GetHostEnvironment

func GetHostEnvironment() IHostEnvironment

func SetupHostEnvironment

func SetupHostEnvironment(opts ...Option) IHostEnvironment

type Option

type Option func(IHostEnvironment)

Jump to

Keyboard shortcuts

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