config

package
v0.0.0-...-351850b Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Copyright 2020 Northern.tech AS

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Index

Constants

View Source
const (
	VersionUnknown = "unknown"
)

Variables

View Source
var (
	DefaultConfDir     = "/etc/mender"
	DefaultPathDataDir = "/usr/share/mender"
	DefaultDataStore   = "/var/lib/mender"

	DefaultShellCommand      = "/bin/sh"
	DefaultDeviceConnectPath = "/api/devices/v1/deviceconnect/connect"

	DefaultTerminalString = "xterm-256color"
	DefaultTerminalHeight = uint16(40)
	DefaultTerminalWidth  = uint16(80)

	DefaultConfFile         = path.Join(GetConfDirPath(), "mender-shell.conf")
	DefaultFallbackConfFile = path.Join(GetStateDirPath(), "mender-shell.conf")

	DefaultDebug = false

	MaxReconnectAttempts             = uint(0) // 0 means to reconnect forever
	DefaultReconnectIntervalsSeconds = 300
	MessageWriteTimeout              = 2 * time.Second
	MaxShellsSpawned                 = uint(16)
)

default configuration paths

View Source
var (
	// Version information of current build
	Version string
)

Functions

func GetConfDirPath

func GetConfDirPath() string

GetConfDirPath returns the default config directory

func GetStateDirPath

func GetStateDirPath() string

GetStateDirPath returns the default data store directory

func ShowVersion

func ShowVersion() string

func ShowVersionCLI

func ShowVersionCLI(ctx *cli.Context) error

func VersionString

func VersionString() string

Types

type MenderShellConfig

type MenderShellConfig struct {
	MenderShellConfigFromFile
	Debug bool
}

MenderShellConfig holds the configuration settings for the Mender shell client

func LoadConfig

func LoadConfig(mainConfigFile string, fallbackConfigFile string) (*MenderShellConfig, error)

LoadConfig parses the mender configuration json-files (/etc/mender/mender-shell.conf and /var/lib/mender/mender-shell.conf) and loads the values into the MenderShellConfig structure defining high level client configurations.

func NewMenderShellConfig

func NewMenderShellConfig() *MenderShellConfig

NewMenderShellConfig initializes a new MenderShellConfig struct

func (*MenderShellConfig) GetHTTPConfig

func (c *MenderShellConfig) GetHTTPConfig() https.Config

GetHTTPConfig returns the configuration for the HTTP client

func (*MenderShellConfig) Validate

func (c *MenderShellConfig) Validate() (err error)

Validate verifies the Servers fields in the configuration

type MenderShellConfigFromFile

type MenderShellConfigFromFile struct {
	// ClientProtocol "https"
	ClientProtocol string
	// HTTPS client parameters
	HTTPSClient https.Client `json:"HttpsClient"`
	// Skip CA certificate validation
	SkipVerify bool
	// Path to server SSL certificate
	ServerCertificate string
	// Server URL (For single server conf)
	ServerURL string
	// List of available servers, to which client can fall over
	Servers []https.MenderServer
	// The command to run as shell
	ShellCommand string
	// Name of the user who owns the shell process
	User string
	// Terminal settings
	Terminal TerminalConfig `json:"Terminal"`
	// User sessions settings
	Sessions SessionsConfig `json:"Sessions"`
	// Reconnect interval
	ReconnectIntervalSeconds int
}

MenderShellConfigFromFile holds the configuration settings read from the config file

type SessionsConfig

type SessionsConfig struct {
	// Whether to stop expired sessions
	StopExpired bool
	// Seconds after startup of a sessions that will make it expire
	ExpireAfter uint32
	// Seconds after last activity of a sessions that will make it expire
	ExpireAfterIdle uint32
	// Max sessions per user
	MaxPerUser uint32
}

type TerminalConfig

type TerminalConfig struct {
	Width  uint16
	Height uint16
}

Jump to

Keyboard shortcuts

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