settings

package module
v0.0.0-...-4060db5 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceTLS   string = "tls"
	ServiceAdmin string = "admin"
	ServiceAPI   string = "api"
)

Types of services

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

Types of settings values

View Source
const (
	AuthNone    string = "none"
	AuthJSON    string = "json"
	AuthDB      string = "db"
	AuthSAML    string = "saml"
	AuthHeaders string = "headers"
	AuthJWT     string = "jwt"
)

Types of authentication

View Source
const (
	LoggingNone    string = "none"
	LoggingStdout  string = "stdout"
	LoggingDB      string = "db"
	LoggingGraylog string = "graylog"
	LoggingSplunk  string = "splunk"
	LoggingELK     string = "elk"
	LoggingKafka   string = "kafka"
)

Types of logging

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

Names for all possible settings values for services

View Source
const (
	QueryResultLink     string = "query_result_link"
	StatusLogsLink      string = "status_logs_link"
	ResultLogsLink      string = "result_logs_link"
	CleanStatusLogs     string = "clean_status_logs"
	CleanStatusInterval string = "clean_status_interval"
	CleanResultLogs     string = "clean_result_logs"
	CleanResultInterval string = "clean_result_interval"
	CleanQueryLogs      string = "clean_query_logs"
	CleanQueryEntries   string = "clean_query_entries"
)

Names for setting values for logging

View Source
const (
	QueryLink   string = "/query/logs/{{NAME}}"
	StatusLink  string = "#status-logs"
	ResultsLink string = "#result-logs"
)

Default values for the setting values for logging

View Source
const (
	JSONListener string = "json_listener"
	JSONPort     string = "json_port"
	JSONHost     string = "json_host"
	JSONAuth     string = "json_auth"
	JSONLogging  string = "json_logging"
)

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

Variables

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

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
	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) CleanQueryEntries

func (conf *Settings) CleanQueryEntries() int64

CleanQueryEntries gets the number of entries to cleanup in query logs

func (*Settings) CleanQueryLogs

func (conf *Settings) CleanQueryLogs() bool

CleanQueryLogs checks if query logs cleanup is enabled

func (*Settings) CleanResultInterval

func (conf *Settings) CleanResultInterval() int64

CleanResultInterval gets the interval in seconds to cleanup result logs

func (*Settings) CleanResultLogs

func (conf *Settings) CleanResultLogs() bool

CleanResultLogs checks if result logs cleanup is enabled

func (*Settings) CleanStatusInterval

func (conf *Settings) CleanStatusInterval() int64

CleanStatusInterval gets the interval in seconds to cleanup status logs

func (*Settings) CleanStatusLogs

func (conf *Settings) CleanStatusLogs() bool

CleanStatusLogs checks if status logs cleanup is enabled

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) 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) DefaultEnv

func (conf *Settings) DefaultEnv(service string) string

DefaultEnv gets the default environment FIXME customize the fallover one

func (*Settings) DeleteValue

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

DeleteValue deletes an existing settings value

func (*Settings) EmptyValue

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

EmptyValue creates an empty value

func (*Settings) GetBoolean

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

GetBoolean gets a boolean settings value by service and name

func (*Settings) GetInfo

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

GetInfo gets the info of a setting

func (*Settings) GetInteger

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

GetInteger gets a numeric settings value by service and name

func (*Settings) GetMap

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

GetMap returns the map of values by service

func (*Settings) GetString

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

GetString gets a string settings value by service and name

func (*Settings) GetValue

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

GetValue gets one value from settings by service and name

func (*Settings) InactiveHours

func (conf *Settings) InactiveHours() 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) bool

IsJSON checks if a JSON value exists by service and name

func (*Settings) IsValue

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

IsValue checks if a settings value exists by service and name

func (*Settings) NewBooleanValue

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

NewBooleanValue creates a new settings value

func (*Settings) NewIntegerValue

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

NewIntegerValue creates a new settings value

func (*Settings) NewJSON

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

NewJSON creates a new JSON value

func (*Settings) NewStringValue

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

NewStringValue creates a new settings value

func (*Settings) NewValue

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

NewValue creates a new settings value

func (*Settings) NodeDashboard

func (conf *Settings) NodeDashboard() bool

NodeDashboard checks if display dashboard per node is enabled

func (conf *Settings) QueryResultLink() string

QueryResultLink gets the value to be used to generate links for on-demand queries results

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 (conf *Settings) ResultLogsLink() string

ResultLogsLink gets the value to be used to generate links for result logs

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 from backend

func (*Settings) RetrieveJSON

func (conf *Settings) RetrieveJSON(service, name string) (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) (SettingValue, error)

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

func (*Settings) RetrieveValues

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

RetrieveValues retrieves and returns all values from backend

func (*Settings) ServiceMetrics

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

ServiceMetrics checks if metrics are enabled by service

func (*Settings) SetAllJSON

func (conf *Settings) SetAllJSON(service, listener, port, host, auth, logging string) error

SetAllJSON sets all the JSON configuration values

func (*Settings) SetBoolean

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

SetBoolean sets a boolean settings value by service and name

func (*Settings) SetInfo

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

SetInfo sets the info of a setting

func (*Settings) SetInteger

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

SetInteger sets a numeric settings value by service and name

func (*Settings) SetJSON

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

SetJSON sets the JSON configuration value

func (*Settings) SetString

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

SetString sets a boolean settings value by service and name

func (conf *Settings) StatusLogsLink() string

StatusLogsLink gets the value to be used to generate links for status logs

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