config

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2023 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	SystemStartJobsFilename = "system_startup_jobs.yaml"
	UserStartJobsFilename   = "user_startup_jobs.yaml"
)
View Source
const (
	DefaultDirDataRoot = "/tmp/mc/data" // default data dir location
	DefaultDirLogsRoot = "/tmp/mc/logs" // default logs dir location
	DefaultDirTmp      = "/tmp/mc/tmp"  // default tmp dir location

	DirectoryDataFirmware  = "/firmware"       // location to keep firmware files
	DirectoryDataStorage   = "/storage"        // location to keep storage database exported files
	DirectoryDataInternal  = "/internal"       // location to keep system internal files
	DirectoryGatewayLogs   = "/gateway_logs"   // location to keep gateway message logs
	DirectoryGatewayTmp    = "/gateway_tmp"    // location to keep gateway related tmp items
	DirectorySecureShare   = "/secure_share"   // location to keep secure share contents, for now used only in backup
	DirectoryInsecureShare = "/insecure_share" // location to keep insecure share contents, for now used only in backup
)

Files, directory locations

Variables

This section is empty.

Functions

func WithContext

func WithContext(ctx context.Context, cfg *Config) context.Context

Types

type Config

type Config struct {
	Secret           string             `yaml:"secret"` // secret used to encrypt sensitive data
	Telemetry        TelemetryConfig    `yaml:"telemetry"`
	Web              WebConfig          `yaml:"web"`
	Logger           LoggerConfig       `yaml:"logger"`
	Directories      Directories        `yaml:"directories"`
	Bus              cmap.CustomMap     `yaml:"bus"`
	Gateway          sfTY.ServiceFilter `yaml:"gateway"`
	Handler          sfTY.ServiceFilter `yaml:"handler"`
	Task             sfTY.ServiceFilter `yaml:"task"`
	Schedule         sfTY.ServiceFilter `yaml:"schedule"`
	VirtualAssistant sfTY.ServiceFilter `yaml:"virtual_assistant"`
	Database         Database           `yaml:"database"`
}

Config of the system

func FrosmContext

func FrosmContext(ctx context.Context) (*Config, error)

func (*Config) Clone

func (c *Config) Clone() *Config

type Database

type Database struct {
	Storage cmap.CustomMap `yaml:"storage"`
	Metric  cmap.CustomMap `yaml:"metric"`
}

Database to be used

type Directories

type Directories struct {
	Data          string `yaml:"data"`
	Logs          string `yaml:"logs"`
	Tmp           string `yaml:"tmp"`
	SecureShare   string `yaml:"secure_share"`
	InsecureShare string `yaml:"insecure_share"`
}

Directories for data and logs

func (*Directories) GetData

func (dr *Directories) GetData() string

return data root directory location

func (*Directories) GetDataFirmware

func (dr *Directories) GetDataFirmware() string

GetDataFirmware location

func (*Directories) GetDataInternal

func (dr *Directories) GetDataInternal() string

GetDirectoryStorage location

func (*Directories) GetDataStorage

func (dr *Directories) GetDataStorage() string

GetDataStorage location

func (*Directories) GetGatewayLogs

func (dr *Directories) GetGatewayLogs() string

GetGatewayLogs location

func (*Directories) GetGatewayTmp

func (dr *Directories) GetGatewayTmp() string

func (*Directories) GetLogs

func (dr *Directories) GetLogs() string

return logs root directory location

func (*Directories) GetTmp

func (dr *Directories) GetTmp() string

returns temporary directory location

type HttpConfig

type HttpConfig struct {
	Enabled     bool   `yaml:"enabled"`
	BindAddress string `yaml:"bind_address"`
	Port        uint   `yaml:"port"`
}

HttpConfig struct

type HttpsACMEConfig

type HttpsACMEConfig struct {
	Enabled       bool     `yaml:"enabled"`
	BindAddress   string   `yaml:"bind_address"`
	Port          uint     `yaml:"port"`
	CacheDir      string   `yaml:"cache_dir"`
	ACMEDirectory string   `yaml:"acme_directory"`
	Email         string   `yaml:"email"`
	Domains       []string `yaml:"domains"`
}

HttpsACMEConfig struct

type HttpsSSLConfig

type HttpsSSLConfig struct {
	Enabled     bool   `yaml:"enabled"`
	BindAddress string `yaml:"bind_address"`
	Port        uint   `yaml:"port"`
	CertDir     string `yaml:"cert_dir"`
}

HttpsSSLConfig struct

type LogLevelConfig

type LogLevelConfig struct {
	Core       string `yaml:"core"`
	WebHandler string `yaml:"web_handler"`
	Storage    string `yaml:"storage"`
	Metric     string `yaml:"metric"`
}

LogLevelConfig input

type LoggerConfig

type LoggerConfig struct {
	Mode             string         `yaml:"mode"`
	Encoding         string         `yaml:"encoding"`
	Level            LogLevelConfig `yaml:"level"`
	EnableStacktrace bool           `yaml:"enable_stacktrace"`
}

LoggerConfig input

type StartupRestore

type StartupRestore struct {
	Enabled            bool   `json:"enabled" yaml:"enabled"`
	ExtractedDirectory string `json:"extracted_directory" yaml:"extracted_directory"`
	ClearDatabase      bool   `json:"clean_database" yaml:"clean_database"`
}

StartupRestore loads data on startup

type SystemStartupJobs

type SystemStartupJobs struct {
	Restore StartupRestore `yaml:"restore"`
}

SystemStartupJobs config

type TelemetryConfig

type TelemetryConfig struct {
	Enabled bool `yaml:"enabled"`
}

TelemetryConfig input

type UserStartupJobs

type UserStartupJobs struct {
	ResetPassword map[string]string `json:"reset_password" yaml:"reset_password"`
}

UserStartupJobs config

type WebConfig

type WebConfig struct {
	WebDirectory     string          `yaml:"web_directory"`
	DocumentationURL string          `yaml:"documentation_url"`
	EnableProfiling  bool            `yaml:"enable_profiling"`
	ReadTimeout      string          `yaml:"read_timeout"`
	Http             HttpConfig      `yaml:"http"`
	HttpsSSL         HttpsSSLConfig  `yaml:"https_ssl"`
	HttpsACME        HttpsACMEConfig `yaml:"https_acme"`
}

WebConfig input

Jump to

Keyboard shortcuts

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