conf

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Copyright 2023 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.

Copyright 2023 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.

Copyright 2023 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 (
	DefaultUpdateControlMapBootExpirationTimeSeconds = 600
)

Variables

View Source
var (
	// needed so that we can override it when testing or deploying on partially read-only systems
	DefaultConfFile    = path.Join(GetConfDirPath(), "mender.conf")
	DefaultPathConfDir = getenv("MENDER_CONF_DIR", "/etc/mender")
	DefaultDataStore   = getenv("MENDER_DATASTORE_DIR", "/var/lib/mender")
	DefaultPathDataDir = getenv("MENDER_DATA_DIR", "/usr/share/mender")
)
View Source
var (
	// device specific paths
	DefaultArtScriptsPath        = path.Join(GetStateDirPath(), "scripts")
	DefaultRootfsScriptsPath     = path.Join(GetConfDirPath(), "scripts")
	DefaultModulesPath           = path.Join(GetDataDirPath(), "modules", "v3")
	DefaultModulesWorkPath       = path.Join(GetStateDirPath(), "modules", "v3")
	DefaultBootstrapArtifactFile = path.Join(GetStateDirPath(), "bootstrap.mender")
)
View Source
var (
	// Version information of current build
	Version string
)

Functions

func GetConfDirPath

func GetConfDirPath() string

func GetDataDirPath

func GetDataDirPath() string

func GetStateDirPath

func GetStateDirPath() string

func SaveConfigFile

func SaveConfigFile(config *MenderConfigFromFile, filename string) error

func ShowVersion

func ShowVersion() string

func VersionString

func VersionString() string

Types

type Connectivity

type Connectivity struct {
	// If set to true, there will be no persistent connections, and every
	// HTTP transaction will try to establish a new connection
	DisableKeepAlive bool `json:",omitempty"`
	// A number of seconds after which a connection is considered idle and closed.
	// The longer this is the longer connections are up after the first call over HTTP
	IdleConnTimeoutSeconds int `json:",omitempty"`
}

Connectivity instructs the client how we want to treat the keep alive connections and when a connection is considered idle and therefore closed NOTE: Careful when changing this, the struct is exposed directly in the 'mender.conf' file.

type HttpConfig

type HttpConfig struct {
	ServerCert string
	*HttpsClient
	*Connectivity
	NoVerify bool
}

type HttpsClient

type HttpsClient struct {
	Certificate string `json:",omitempty"`
	Key         string `json:",omitempty"`
	SSLEngine   string `json:",omitempty"`
}

HttpsClient holds the configuration for the client side mTLS configuration NOTE: Careful when changing this, the struct is exposed directly in the 'mender.conf' file.

type MenderConfig

type MenderConfig struct {
	MenderConfigFromFile

	// Additional fields that are in our config struct for convenience, but
	// not actually configurable via the config file.
	ModulesPath     string
	ModulesWorkPath string

	ArtifactScriptsPath string
	RootfsScriptsPath   string

	BootstrapArtifactFile string
}

func LoadConfig

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

func NewMenderConfig

func NewMenderConfig() *MenderConfig

type MenderConfigFromFile

type MenderConfigFromFile struct {
	// Path to the public key used to verify signed updates.
	// Only one of ArtifactVerifyKey/ArtifactVerifyKeys can be specified.
	ArtifactVerifyKey string `json:",omitempty"`
	// List of verification keys for verifying signed updates.
	// Starting in order from the first key in the list,
	// each key will try to verify the artifact until one succeeds.
	// Only one of ArtifactVerifyKey/ArtifactVerifyKeys can be specified.
	ArtifactVerifyKeys []string `json:",omitempty"`

	// HTTPS client parameters
	HttpsClient HttpsClient `json:",omitempty"`
	// Security parameters
	Security Security `json:",omitempty"`
	// Connectivity connection handling and transfer parameters
	Connectivity Connectivity `json:",omitempty"`

	// Rootfs device path
	RootfsPartA string `json:",omitempty"`
	RootfsPartB string `json:",omitempty"`

	// Command to set active partition.
	BootUtilitiesSetActivePart string `json:",omitempty"`
	// Command to get the partition which will boot next.
	BootUtilitiesGetNextActivePart string `json:",omitempty"`

	// Path to the device type file
	DeviceTypeFile string `json:",omitempty"`

	// Expiration timeout for the control map
	UpdateControlMapExpirationTimeSeconds int `json:",omitempty"`
	// Expiration timeout for the control map when just booted
	UpdateControlMapBootExpirationTimeSeconds int `json:",omitempty"`

	// Poll interval for checking for new updates
	UpdatePollIntervalSeconds int `json:",omitempty"`
	// Poll interval for periodically sending inventory data
	InventoryPollIntervalSeconds int `json:",omitempty"`

	// Skip CA certificate validation
	SkipVerify bool `json:",omitempty"`

	// Global retry polling max interval for fetching update, authorize wait and update status
	RetryPollIntervalSeconds int `json:",omitempty"`
	// Global max retry poll count
	RetryPollCount int `json:",omitempty"`

	// State script parameters
	StateScriptTimeoutSeconds      int `json:",omitempty"`
	StateScriptRetryTimeoutSeconds int `json:",omitempty"`
	// Poll interval for checking for update (check-update)
	StateScriptRetryIntervalSeconds int `json:",omitempty"`

	// The timeout for the execution of the update module, after which it
	// will be killed.
	ModuleTimeoutSeconds int `json:",omitempty"`

	// Path to server SSL certificate
	ServerCertificate string `json:",omitempty"`
	// Server URL (For single server conf)
	ServerURL string `json:",omitempty"`
	// Path to deployment log file
	UpdateLogPath string `json:",omitempty"`
	// Server JWT TenantToken
	TenantToken string `json:",omitempty"`
	// List of available servers, to which client can fall over
	Servers []MenderServer `json:",omitempty"`
	// Log level which takes effect right before daemon startup
	DaemonLogLevel string `json:",omitempty"`
}

type MenderServer

type MenderServer struct {
	ServerURL string
}

MenderServer is a placeholder for a full server definition used when multiple servers are given. The fields corresponds to the definitions given in MenderConfig.

type Security

type Security struct {
	AuthPrivateKey string `json:",omitempty"`
	SSLEngine      string `json:",omitempty"`
}

Jump to

Keyboard shortcuts

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