settings

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RunModeAudit is the string used to configure audit mode
	RunModeAudit string = "audit"
	// RunModeScanner is the string used to configure scanner mode
	RunModeScanner string = "scanner"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Audit

type Audit struct {
	Mode string `config:"mode"`
}

Audit holds the configuration options referred to a audit mode

type Group

type Group struct {
	RAM    int64 `config:"ram"`
	CPU    int   `config:"cpu"`
	Pids   int64 `config:"pids"`
	Freeze bool  `group:"freeze"`
}

Group holds the configuration options referred to a single process group

type Logging

type Logging struct {
	File  string `config:"file"`
	Level string `config:"level"`
}

Logging holds the configuration options referred to logging

type Rule

type Rule struct {
	Paths   []string `config:"paths,required"`
	Action  string   `config:"action,required"`
	Group   string   `config:"group"`
	Trigger string   `config:"trigger"`
}

Rule holds the configuration options referred to a single rule

type Settings

type Settings struct {
	Logging  Logging            `config:"logging,required"`
	Rules    map[string]Rule    `config:"rules,required"`
	Groups   map[string]Group   `config:"groups"`
	Triggers map[string]Trigger `config:"triggers"`
	Audit    Audit              `config:"audit"`
	Name     string             `config:"name,required"`
	Mode     string             `config:"mode,required"`
}

Settings holds the configuration options referred to the whole application

func Load

func Load(path string) (settings *Settings, err error)

Load configuration into settings variable

func (*Settings) GetGroup added in v0.2.0

func (s *Settings) GetGroup(rule string) string

GetGroup returns the name of a group configured for a rule

func (*Settings) GetTrigger added in v0.2.0

func (s *Settings) GetTrigger(rule string) string

GetTrigger returns the name of a trigger configured for a rule

type Trigger added in v0.2.0

type Trigger struct {
	Run  string   `config:"run"`
	Args []string `config:"args"`
	User string   `config:"user"`
}

Trigger holds the configuration options referred to a single trigger

Jump to

Keyboard shortcuts

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