config

package
v0.0.0-...-5bd05a1 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// name of the file which stores the source credentials
	CredentialsFile = "credentials.json"
	// name of the file which stores the current inventory
	InventoryFile = "inventory.json"
	// DefaultUpdateInterval is the default interval between two status updates
	DefaultUpdateInterval = time.Duration(60 * time.Second)
	// DefaultConfigDir is the default directory where the device's configuration is stored
	DefaultConfigDir = "/etc/planner"
	// DefaultConfigFile is the default path to the agent's configuration file
	DefaultConfigFile = DefaultConfigDir + "/config.yaml"
	// DefaultDataDir is the default directory where the agent's data is stored
	DefaultDataDir = "/var/lib/planner"
	// DefaultWwwDir is the default directory from which the agent serves static files
	DefaultWwwDir = "/var/www/planner"
	// DefaultPlannerEndpoint is the default address of the migration planner server
	DefaultPlannerEndpoint = "https://localhost:7443"
	// DefaultHealthCheck is the default value for health check interval in seconds.
	// default value set 10s health check should be faster than the update period in order to block it
	// if the console is unreachable
	DefaultHealthCheck = 10
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// ConfigDir is the directory where the agent's configuration is stored
	ConfigDir string `json:"config-dir"`
	// DataDir is the directory where the agent's data is stored
	DataDir string `json:"data-dir"`
	// WwwDir is the directory from which the agent serves static files
	WwwDir string `json:"www-dir"`
	// SourceID is the ID of this source in the planner
	SourceID string `json:"source-id"`

	// PlannerService is the client configuration for connecting to the migration planner server
	PlannerService PlannerService `json:"planner-service,omitempty"`

	// UpdateInterval is the interval between two status updates
	UpdateInterval util.Duration `json:"update-interval,omitempty"`

	// LogLevel is the level of logging. can be:  "panic", "fatal", "error", "warn"/"warning",
	// "info", "debug" or "trace", any other will be treated as "info"
	LogLevel string `json:"log-level,omitempty"`
	// LogPrefix is the log prefix used for testing
	LogPrefix string `json:"log-prefix,omitempty"`
	// HealthCheckInterval is the interval between two health checks
	HealthCheckInterval int64 `json:"health-check-interval,omitempty"`
	// contains filtered or unexported fields
}

func NewDefault

func NewDefault() *Config

func (*Config) ParseConfigFile

func (cfg *Config) ParseConfigFile(cfgFile string) error

ParseConfigFile reads the config file and unmarshals it into the Config struct

func (*Config) String

func (cfg *Config) String() string

func (*Config) Validate

func (cfg *Config) Validate() error

Validate checks that the required fields are set and that the paths exist.

type Credentials

type Credentials struct {
	URL                  string `json:"url"`
	Username             string `json:"username"`
	Password             string `json:"password"`
	IsDataSharingAllowed bool   `json:"isDataSharingAllowed"`
}

type PlannerService

type PlannerService struct {
	client.Config
}

func (*PlannerService) Equal

func (s *PlannerService) Equal(s2 *PlannerService) bool

Jump to

Keyboard shortcuts

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