config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2022 License: GPL-2.0 Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CmonInstance

type CmonInstance struct {
	Url         string `yaml:"url" json:"url"`
	Name        string `yaml:"name,omitempty" json:"name,omitempty"`
	Username    string `yaml:"username,omitempty" json:"username,omitempty`
	Password    string `yaml:"password,omitempty" json:"password,omitempty"`
	Keyfile     string `yaml:"keyfile,omitempty" json:"keyfile,omitempty"`
	FrontendUrl string `yaml:"frontend_url,omitempty" json:"frontend_url,omitempty"`
}

func (*CmonInstance) Verify

func (cmon *CmonInstance) Verify() error

type Config

type Config struct {
	Filename        string
	FetchJobsHours  int             `yaml:"fetch_jobs_hours,omitempty" json:"fetch_jobs_hours,omitempty"`
	FetchBackupDays int             `yaml:"fetch_backups_days,omitempty" json:"fetch_backups_days,omitempty"`
	Instances       []*CmonInstance `yaml:"instances,omitempty"`
	Timeout         int             `yaml:"timeout,omitempty"`
	Logfile         string          `yaml:"logfile,omitempty"`
	Users           []*ProxyUser    `yaml:"users,omitempty"`
	FrontendPath    string          `yaml:"frontend_path,omitempty" json:"frontend_path,omitempty"`
	Port            int             `yaml:"port" json:"port"`
	TlsCert         string          `yaml:"tls_cert,omitempty" json:"tls_cert,omitempty"`
	TlsKey          string          `yaml:"tls_key,omitempty" json:"tls_key,omitempty"`
	SessionTtl      int64           `yaml:"session_ttl" json:"session_ttl"`
	// contains filtered or unexported fields
}

Config holds the configuration of cmon-proxy, it is pretty minimal now

func Load

func Load(filename string, loadFromCli ...bool) (*Config, error)

Load loads the configuration from the specified file name

func (*Config) AddController

func (cfg *Config) AddController(cmon *CmonInstance, persist bool) error

AddController adds a controller to the configuration and perists the config

func (*Config) AddUser

func (cfg *Config) AddUser(user *ProxyUser) error

func (*Config) ControllerByUrl

func (cfg *Config) ControllerByUrl(url string) *CmonInstance

ControllerByUrl returns a CmonInstance having the specified url

func (*Config) ControllerUrls

func (cfg *Config) ControllerUrls() []string

ControllerUrls returns the URLs of the configured controllers

func (*Config) GetUser

func (cfg *Config) GetUser(username string) (*ProxyUser, error)

func (*Config) RemoveController

func (cfg *Config) RemoveController(url string, persist bool) error

RemoveConroller removes a cmon instance from config file and persists the configuration

func (*Config) RemoveUser

func (cfg *Config) RemoveUser(username string) error

func (*Config) Save

func (cfg *Config) Save() error

Save persist the configuration to the file it was loaded from

func (*Config) UpdateUser

func (cfg *Config) UpdateUser(user *ProxyUser) error

type ProxyUser

type ProxyUser struct {
	Username     string `yaml:"username,omitempty" json:"username,omitempty"`
	EmailAddress string `yaml:"email,omitempty" json:"email,omitempty"`
	PasswordHash string `yaml:"passwordhash,omitempty" json:"passwordhash,omitempty"`
	FirstName    string `yaml:"firstname,omitempty" json:"firstname,omitempty"`
	LastName     string `yaml:"lastname,omitempty" json:"lastname,omitempty"`
}

func (*ProxyUser) Copy

func (u *ProxyUser) Copy(withCredentials bool) *ProxyUser

func (*ProxyUser) SetPassword

func (user *ProxyUser) SetPassword(password string) error

func (*ProxyUser) Validate

func (user *ProxyUser) Validate() error

func (*ProxyUser) ValidatePassword

func (user *ProxyUser) ValidatePassword(password string) error

Jump to

Keyboard shortcuts

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