conf

package
v0.0.0-...-0e32600 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: Apache-2.0 Imports: 11 Imported by: 4

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.

Index

Constants

View Source
const (
	BrokenArtifactSuffix = "_INCONSISTENT"
)
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
	DefaultPathConfDir = getenv("MENDER_CONF_DIR", "/etc/mender")
	DefaultPathDataDir = getenv("MENDER_DATA_DIR", "/usr/share/mender")
	DefaultDataStore   = getenv("MENDER_DATASTORE_DIR", "/var/lib/mender")
	DefaultKeyFile     = "mender-agent.pem"

	DefaultConfFile         = path.Join(GetConfDirPath(), "mender.conf")
	DefaultFallbackConfFile = path.Join(GetStateDirPath(), "mender.conf")
)
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")

	// deprecated files
	DeprecatedArtifactInfoFile = path.Join(GetConfDirPath(), "artifact_info")
)
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 DBusConfig

type DBusConfig struct {
	Enabled bool
}

type DualRootfsDeviceConfig

type DualRootfsDeviceConfig struct {
	RootfsPartA string
	RootfsPartB string
}

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)

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

func NewMenderConfig

func NewMenderConfig() *MenderConfig

func (*MenderConfig) GetDeploymentLogLocation

func (c *MenderConfig) GetDeploymentLogLocation() string

func (*MenderConfig) GetDeviceConfig

func (c *MenderConfig) GetDeviceConfig() DualRootfsDeviceConfig

func (*MenderConfig) GetHttpConfig

func (c *MenderConfig) GetHttpConfig() client.Config

func (*MenderConfig) GetTenantToken

func (c *MenderConfig) GetTenantToken() []byte

GetTenantToken returns a default tenant-token if no custom token is set in local.conf

func (*MenderConfig) GetVerificationKeys

func (c *MenderConfig) GetVerificationKeys() []*VerificationKey

GetVerificationKeys reads all verification keys.

func (*MenderConfig) Validate

func (c *MenderConfig) Validate() error

Validate verifies the Servers fields in the configuration

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 client.HttpsClient `json:",omitempty"`
	// Security parameters
	Security client.Security `json:",omitempty"`
	// Connectivity connection handling and transfer parameters
	Connectivity client.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"`
	// DBus configuration
	DBus DBusConfig `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 []client.MenderServer `json:",omitempty"`
	// Log level which takes effect right before daemon startup
	DaemonLogLevel string `json:",omitempty"`
}

func (*MenderConfigFromFile) GetUpdateControlMapBootExpirationTimeSeconds

func (c *MenderConfigFromFile) GetUpdateControlMapBootExpirationTimeSeconds() int

func (*MenderConfigFromFile) GetUpdateControlMapExpirationTimeSeconds

func (c *MenderConfigFromFile) GetUpdateControlMapExpirationTimeSeconds() int

type VerificationKey

type VerificationKey struct {
	Path string
	Data []byte
}

Jump to

Keyboard shortcuts

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