Help us shape the future of Go! Take the 2026 Go Developer Survey

settings

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeString  string = "string"
	TypeBoolean string = "boolean"
	TypeInteger string = "integer"
)

Types of settings values

View Source
const (
	ScriptEnroll string = "enroll"
	ScriptRemove string = "remove"
)

Types of script

View Source
const (
	ActionExpire    string = "expire"
	ActionExtend    string = "extend"
	ActionRotate    string = "rotate"
	ActionNotexpire string = "notexpire"
	SetMacPackage   string = "set_pkg"
	SetMsiPackage   string = "set_msi"
	SetDebPackage   string = "set_deb"
	SetRpmPackage   string = "set_rpm"
)

Types of enroll/remove actions

View Source
const (
	QueryDelete   string = "delete"
	QueryExpire   string = "expire"
	QueryComplete string = "complete"
	CarveDelete   string = QueryDelete
	CarveExpire   string = QueryExpire
	CarveComplete string = QueryComplete
)

Types of query/carve actions

View Source
const (
	PackageDeb string = "deb"
	PackageRpm string = "rpm"
	PackagePkg string = "pkg"
	PackageMsi string = "msi"
)

Types of package

View Source
const (
	DownloadSecret       string = "secret"
	DownloadCert         string = "cert"
	DownloadFlags        string = "flags"
	DownloadFlagsMac     string = "flagsMac"
	DownloadFlagsWin     string = "flagsWindows"
	DownloadFlagsLinux   string = "flagsLinux"
	DownloadFlagsFreeBSD string = "flagsFreeBSD"
)

Types of download target

View Source
const (
	PlatformDarwin  string = "darwin"
	PlatformLinux   string = "linux"
	PlatformWindows string = "windows"
)

Types of platform

View Source
const (
	DebugHTTP          string = "debug_http"
	DebugService       string = "debug_service"
	RefreshEnvs        string = "refresh_envs"
	RefreshSettings    string = "refresh_settings"
	CleanupSessions    string = "cleanup_sessions"
	CleanupExpired     string = "cleanup_expired"
	ServiceMetrics     string = "service_metrics"
	MetricsHost        string = "metrics_host"
	MetricsPort        string = "metrics_port"
	MetricsProtocol    string = "metrics_protocol"
	InactiveHours      string = "inactive_hours"
	AcceleratedSeconds string = "accelerated_seconds"
	NodeDashboard      string = "node_dashboard"
	OnelinerExpiration string = "oneliner_expiration"
)

Names for all possible settings values for services

View Source
const (
	JSONListener   string = "json_listener"
	JSONPort       string = "json_port"
	JSONHost       string = "json_host"
	JSONAuth       string = "json_auth"
	JSONLogger     string = "json_logger"
	JSONCarver     string = "json_carver"
	JSONSessionKey string = "json_sessionkey"
)

Names for the values that are read from the JSON config file

View Source
const (
	NoEnvironmentID = iota
)

Values for generic IDs

Variables

View Source
var ValidServices = map[string]struct{}{
	config.ServiceTLS:   {},
	config.ServiceAdmin: {},
	config.ServiceAPI:   {},
}

ValidServices to check validity of settings service

View Source
var ValidTypes = map[string]struct{}{
	TypeString:  {},
	TypeBoolean: {},
	TypeInteger: {},
}

ValidTypes to check validity of settings type

Functions

This section is empty.

Types

type MapSettings

type MapSettings map[string]SettingValue

MapSettings to hold all values by service

type SettingValue

type SettingValue struct {
	gorm.Model
	Name          string `gorm:"index"`
	Service       string
	EnvironmentID uint
	JSON          bool
	Type          string
	String        string
	Boolean       bool
	Integer       int64
	Info          string
}

SettingValue to hold each value for settings

type Settings

type Settings struct {
	DB *gorm.DB
}

Settings keeps all settings values

func NewSettings

func NewSettings(backend *gorm.DB) *Settings

NewSettings to initialize the access to settings and table

func (*Settings) CleanupExpired

func (conf *Settings) CleanupExpired() int64

CleanupExpired gets the interval in seconds to cleanup expired queries and carves

func (*Settings) CleanupSessions

func (conf *Settings) CleanupSessions() int64

CleanupSessions gets the interval in seconds to cleanup expired sessions by service

func (*Settings) DebugHTTP

func (conf *Settings) DebugHTTP(service string, envID uint) bool

DebugHTTP checks if http debugging is enabled by service

func (*Settings) DebugService

func (conf *Settings) DebugService(service string) bool

DebugService checks if debugging is enabled by service

func (*Settings) DeleteValue

func (conf *Settings) DeleteValue(service, name string, envID uint) error

DeleteValue deletes an existing settings value

func (*Settings) EmptyValue

func (conf *Settings) EmptyValue(service, name, typeValue string, envID uint) SettingValue

EmptyValue creates an empty value

func (*Settings) GetBoolean

func (conf *Settings) GetBoolean(service, name string, envID uint) (bool, error)

GetBoolean gets a boolean settings value by service and name

func (*Settings) GetInfo

func (conf *Settings) GetInfo(service, name string, envID uint) (string, error)

GetInfo gets the info of a setting

func (*Settings) GetInteger

func (conf *Settings) GetInteger(service, name string, envID uint) (int64, error)

GetInteger gets a numeric settings value by service and name

func (*Settings) GetMap

func (conf *Settings) GetMap(service string, envID uint) (MapSettings, error)

GetMap returns the map of values by service, excluding JSON

func (*Settings) GetString

func (conf *Settings) GetString(service, name string, envID uint) (string, error)

GetString gets a string settings value by service and name

func (*Settings) GetValue

func (conf *Settings) GetValue(service, name string, envID uint) (SettingValue, error)

GetValue gets one value from settings by service and name

func (*Settings) InactiveHours

func (conf *Settings) InactiveHours(envID uint) int64

InactiveHours gets the value in hours for a node to be inactive by service

func (*Settings) IsJSON

func (conf *Settings) IsJSON(service, name string, envID uint) bool

IsJSON checks if a JSON value exists by service and name

func (*Settings) IsValue

func (conf *Settings) IsValue(service, name string, envID uint) bool

IsValue checks if a settings value exists by service and name

func (*Settings) NewBooleanValue

func (conf *Settings) NewBooleanValue(service, name string, value bool, envID uint) error

NewBooleanValue creates a new settings value

func (*Settings) NewIntegerValue

func (conf *Settings) NewIntegerValue(service, name string, value int64, envID uint) error

NewIntegerValue creates a new settings value

func (*Settings) NewJSON

func (conf *Settings) NewJSON(service, name, value string, envID uint) error

NewJSON creates a new JSON value

func (*Settings) NewStringValue

func (conf *Settings) NewStringValue(service, name, value string, envID uint) error

NewStringValue creates a new settings value

func (*Settings) NewValue

func (conf *Settings) NewValue(service, name, typeValue string, value interface{}, envID uint) error

NewValue creates a new settings value

func (*Settings) NodeDashboard

func (conf *Settings) NodeDashboard(envID uint) bool

NodeDashboard checks if display dashboard per node is enabled

func (*Settings) OnelinerExpiration

func (conf *Settings) OnelinerExpiration(envID uint) bool

OnelinerExpiration checks if enrolling links will expire

func (*Settings) RefreshEnvs

func (conf *Settings) RefreshEnvs(service string) int64

RefreshEnvs gets the interval in seconds to refresh environments by service

func (*Settings) RefreshSettings

func (conf *Settings) RefreshSettings(service string) int64

RefreshSettings gets the interval in seconds to refresh settings by service

func (*Settings) RetrieveAll

func (conf *Settings) RetrieveAll() ([]SettingValue, error)

RetrieveAll retrieves and returns all values from backend

func (*Settings) RetrieveAllEnv

func (conf *Settings) RetrieveAllEnv(envID uint) ([]SettingValue, error)

RetrieveAllEnv retrieves and returns all values from backend per environment

func (*Settings) RetrieveAllEnvJSON

func (conf *Settings) RetrieveAllEnvJSON(service string, envID uint) ([]SettingValue, error)

RetrieveAllEnvJSON retrieves and returns all JSON values from backend

func (*Settings) RetrieveAllEnvValues

func (conf *Settings) RetrieveAllEnvValues(envID uint) ([]SettingValue, error)

RetrieveAllEnvValues retrieves and returns all values excepting JSON from backend

func (*Settings) RetrieveAllJSON

func (conf *Settings) RetrieveAllJSON(service string) ([]SettingValue, error)

RetrieveAllJSON retrieves and returns all JSON values from backend

func (*Settings) RetrieveAllValues

func (conf *Settings) RetrieveAllValues() ([]SettingValue, error)

RetrieveAllValues retrieves and returns all values excepting JSON from backend

func (*Settings) RetrieveJSON

func (conf *Settings) RetrieveJSON(service, name string, envID uint) (SettingValue, error)

RetrieveJSON retrieves one JSON value from settings by service and name from backend

func (*Settings) RetrieveValue

func (conf *Settings) RetrieveValue(service, name string, envID uint) (SettingValue, error)

RetrieveValue retrieves one value from settings by service and name from backend

func (*Settings) RetrieveValues

func (conf *Settings) RetrieveValues(service string, jsonSetting bool, envID uint) ([]SettingValue, error)

RetrieveValues retrieves and returns all values from backend

func (*Settings) SetAPIJSON

func (conf *Settings) SetAPIJSON(cfg config.JSONConfigurationService, envID uint) error

SetAPIJSON sets all the JSON configuration values for API service

func (*Settings) SetAdminJSON

func (conf *Settings) SetAdminJSON(cfg config.JSONConfigurationService, envID uint) error

SetAdminJSON sets all the JSON configuration values for admin service

func (*Settings) SetBoolean

func (conf *Settings) SetBoolean(boolValue bool, service, name string, envID uint) error

SetBoolean sets a boolean settings value by service and name

func (*Settings) SetInfo

func (conf *Settings) SetInfo(info string, service, name string, envID uint) error

SetInfo sets the info of a setting

func (*Settings) SetInteger

func (conf *Settings) SetInteger(intValue int64, service, name string, envID uint) error

SetInteger sets a numeric settings value by service and name

func (*Settings) SetJSON

func (conf *Settings) SetJSON(service, name, value string, envID uint) error

SetJSON sets the JSON configuration value

func (*Settings) SetString

func (conf *Settings) SetString(strValue string, service, name string, _json bool, envID uint) error

SetString sets a boolean settings value by service and name

func (*Settings) SetTLSJSON

func (conf *Settings) SetTLSJSON(cfg config.JSONConfigurationService, envID uint) error

SetTLSJSON sets all the JSON configuration values for TLS service

func (*Settings) VerifyService

func (conf *Settings) VerifyService(sType string) bool

VerifyService to make sure service is valid

func (*Settings) VerifyType

func (conf *Settings) VerifyType(sType string) bool

VerifyType to make sure type is valid

Jump to

Keyboard shortcuts

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