config

package
v0.0.0-...-f69eaad Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Conf = &Config{
	Name:                name,
	CoreHost:            "http://localhost:8080",
	BootstrapToken:      "",
	BindHost:            "0.0.0.0",
	SSHPort:             "2222",
	SSHTimeout:          15,
	HTTPPort:            "5000",
	HeartbeatDuration:   10,
	AccessKey:           "",
	AccessKeyFile:       "data/keys/.access_key",
	LogLevel:            "DEBUG",
	HostKeyFile:         "data/keys/host_key",
	HostKey:             "",
	RootPath:            rootPath,
	Comment:             "Coco",
	ReplayStorage:       map[string]interface{}{"TYPE": "server"},
	CommandStorage:      map[string]interface{}{"TYPE": "server"},
	UploadFailedReplay:  true,
	ShowHiddenFile:      false,
	ReuseConnection:     true,
	AssetLoadPolicy:     "",
	ZipMaxSize:          "1024M",
	ZipTmpPath:          "/tmp",
	ClientAliveInterval: 30,
	RetryAliveCountMax:  3,
	ShareRoomType:       "local",
	RedisHost:           "127.0.0.1",
	RedisPort:           "6379",
	RedisPassword:       "",
}

Functions

func Initial

func Initial(confPath string)

func SetConf

func SetConf(conf Config)

Types

type Config

type Config struct {
	AssetListPageSize   string                 `json:"TERMINAL_ASSET_LIST_PAGE_SIZE"`
	AssetListSortBy     string                 `json:"TERMINAL_ASSET_LIST_SORT_BY"`
	HeaderTitle         string                 `json:"TERMINAL_HEADER_TITLE"`
	HostKey             string                 `json:"TERMINAL_HOST_KEY" yaml:"HOST_KEY"`
	PasswordAuth        bool                   `json:"TERMINAL_PASSWORD_AUTH" yaml:"PASSWORD_AUTH"`
	PublicKeyAuth       bool                   `json:"TERMINAL_PUBLIC_KEY_AUTH" yaml:"PUBLIC_KEY_AUTH"`
	CommandStorage      map[string]interface{} `json:"TERMINAL_COMMAND_STORAGE"`
	ReplayStorage       map[string]interface{} `json:"TERMINAL_REPLAY_STORAGE" yaml:"REPLAY_STORAGE"`
	SessionKeepDuration time.Duration          `json:"TERMINAL_SESSION_KEEP_DURATION"`
	TelnetRegex         string                 `json:"TERMINAL_TELNET_REGEX"`
	MaxIdleTime         time.Duration          `json:"SECURITY_MAX_IDLE_TIME"`
	HeartbeatDuration   time.Duration          `json:"TERMINAL_HEARTBEAT_INTERVAL"`
	ShowHiddenFile      bool                   `yaml:"SFTP_SHOW_HIDDEN_FILE"`
	ReuseConnection     bool                   `yaml:"REUSE_CONNECTION"`
	Name                string                 `yaml:"NAME"`
	HostKeyFile         string                 `yaml:"HOST_KEY_FILE"`
	CoreHost            string                 `yaml:"CORE_HOST"`
	BootstrapToken      string                 `yaml:"BOOTSTRAP_TOKEN"`
	BindHost            string                 `yaml:"BIND_HOST"`
	SSHPort             string                 `yaml:"SSHD_PORT"`
	HTTPPort            string                 `yaml:"HTTPD_PORT"`
	SSHTimeout          time.Duration          `yaml:"SSH_TIMEOUT"`
	AccessKey           string                 `yaml:"ACCESS_KEY"`
	AccessKeyFile       string                 `yaml:"ACCESS_KEY_FILE"`
	LogLevel            string                 `yaml:"LOG_LEVEL"`
	RootPath            string                 `yaml:"ROOT_PATH"`
	Comment             string                 `yaml:"COMMENT"`
	Language            string                 `yaml:"LANG"`
	LanguageCode        string                 `yaml:"LANGUAGE_CODE"` // Abandon
	UploadFailedReplay  bool                   `yaml:"UPLOAD_FAILED_REPLAY_ON_START"`
	AssetLoadPolicy     string                 `yaml:"ASSET_LOAD_POLICY"` // all
	ZipMaxSize          string                 `yaml:"ZIP_MAX_SIZE"`
	ZipTmpPath          string                 `yaml:"ZIP_TMP_PATH"`
	ClientAliveInterval uint64                 `yaml:"CLIENT_ALIVE_INTERVAL"`
	RetryAliveCountMax  int                    `yaml:"RETRY_ALIVE_COUNT_MAX"`

	ShareRoomType string   `yaml:"SHARE_ROOM_TYPE"`
	RedisHost     string   `yaml:"REDIS_HOST"`
	RedisPort     string   `yaml:"REDIS_PORT"`
	RedisPassword string   `yaml:"REDIS_PASSWORD"`
	RedisDBIndex  uint64   `yaml:"REDIS_DB_ROOM"`
	RedisClusters []string `yaml:"REDIS_CLUSTERS"`
}

func GetConf

func GetConf() Config

func (*Config) EnsureConfigValid

func (c *Config) EnsureConfigValid()

func (*Config) Load

func (c *Config) Load(filepath string) error

func (*Config) LoadFromEnv

func (c *Config) LoadFromEnv() error

func (*Config) LoadFromJSON

func (c *Config) LoadFromJSON(body []byte) error

func (*Config) LoadFromYAML

func (c *Config) LoadFromYAML(body []byte) error

func (*Config) LoadFromYAMLPath

func (c *Config) LoadFromYAMLPath(filepath string) error

Jump to

Keyboard shortcuts

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