config

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package config provides configuration support for swctl.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound is the error when the configuration does not exists

Functions

func CreateDefaultConfiguration

func CreateDefaultConfiguration() error

CreateDefaultConfiguration saves the default configuration to the config file

func GetConfigHome

func GetConfigHome() string

GetConfigHome returns the home directory for the configuration

func GetConfigPath

func GetConfigPath() string

GetConfigPath returns the path for SiteWhere Control CLI configuration path.

func LoadConfigurationTemplate

func LoadConfigurationTemplate(placeHolder *PlaceHolder) (string, error)

LoadConfigurationTemplate loads the configuration template from ~/swctl/deafult.yaml file. If the files does not exist it returns the error ErrNotFound

Types

type Configuration

type Configuration struct {
	// Microservices are the definitions of the microservices
	Microservices []sitewhereiov1alpha4.SiteWhereMicroserviceSpec `json:"microservices,omitempty"`
}

Configuration is the configuratio of SiteWhere Control CLI

func FromTemplate

func FromTemplate(templateContent string, placeHolder *PlaceHolder) (*Configuration, error)

FromTemplate renders the configuration from a template

func LoadConfigurationOrDefault

func LoadConfigurationOrDefault(placeHolder *PlaceHolder) (*Configuration, error)

LoadConfigurationOrDefault loads the configuration from ~/swctl/config file or load the default configuration

type PlaceHolder

type PlaceHolder struct {
	// Name of the instance
	InstanceName string
	// Number of replicas
	Replicas int32
	// Registry is the docker registry of the microservices images
	Registry string
	// Repository
	Repository string
	// Docker image tag
	Tag string
}

PlaceHolder are the values sent to the template for replacement

Jump to

Keyboard shortcuts

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