config

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version = "0.0.0"
	Commit  = "xxx"
	Branch  = "undefined"
)
View Source
var (
	SupportedShells = []string{"/bin/bash", "/bin/zsh", "/bin/fish"}
)

Functions

func GetHomeDir

func GetHomeDir(isRoot bool, user *user.User) (string, error)

GetHomeDir returns the user home directory

func GetOdaBinaryPath added in v0.0.4

func GetOdaBinaryPath() (string, error)

GetOdaBinaryPath returns the path to the oda binary

func GetOdaDir added in v0.0.4

func GetOdaDir(homeDir string, user *user.User) (string, error)

GetOdaDir returns the directory for the shell configuration

func GetShell

func GetShell() (map[ShellType]string, error)

GetShell sets the current active shell and location

func GetUserConfig

func GetUserConfig() (*user.User, bool, error)

GetUserConfig returns the user configuration

func SetupConfig

func SetupConfig(odaDir string, user *user.User)

SetupConfig initialize the configuration instance

func SetupSysConfig

func SetupSysConfig()

SetupSysConfig initialize the system configuration instance

Types

type Config

type Config struct {
	// Debug persists the debug mode, so we don't have to pass it via flag, flag will override this
	Debug bool `mapstructure:"debug"`
	// ProcessInterval interval in seconds to tick and collect general information about processes - defaults to 120 seconds
	ProcessInterval int `mapstructure:"process_interval"`
	// CommandInterval interval in which to collect process information when command has been executed - defaults to 1 second
	CommandInterval int `mapstructure:"command_interval"`
	// CommandIntervalMultiplier multiplier for the command interval - defaults to 3 (cubic)
	CommandIntervalMultiplier float64 `mapstructure:"command_interval_multiplier"`
	// MaxDuration max duration that collection can run for
	MaxDuration int `mapstructure:"max_duration"`
	// MaxConcurrentCommands maximum number of concurrent commands to collect - defaults to 20
	MaxConcurrentCommands int `mapstructure:"max_concurrent_commands"`
	// RemoteCollection flag to enable remote collection - defaults to false
	RemoteCollection bool `mapstructure:"remote_collection"`
	// ServerAddress host to connect to for remote collection
	ServerAddress string `mapstructure:"server_host"`
	// SecureConnection flag to enable secure connection to the server
	SecureConnection bool `mapstructure:"secure_connection"`
	// CertFile path to the certificate file
	CertFile string `mapstructure:"cert_file"`
	// ExcludeRegex regular expression to exclude processes from collection
	ExcludeRegex string `mapstructure:"exclude_regex"`
	// ExcludeCommands regular expression to exclude commands from collection
	ExcludeCommands []string `mapstructure:"exclude_commands"`
	// ProcessCollectionType type of process collection to use, ps or psutil
	ProcessCollectionType string `mapstructure:"process_collection_type"`
	// TeamID is the team identifier for the workspace
	TeamID string `mapstructure:"team_id"`
	// UserID is the user identifier for the workspace
	UserID string `mapstructure:"user_id"`
	// UserEmail is the user identifier for the workspace
	UserEmail string `mapstructure:"user_email"`
	// WorkspaceID is the workspace identifier
	WorkspaceID string `mapstructure:"workspace_id"`
}

Config config definition

var AppConfig *Config

AppConfig is the global configuration instance

type OSType

type OSType int

OSType is the type of the operating system

const (
	Linux OSType = 0
	MacOS OSType = 1
)

func GetOS

func GetOS() (OSType, string, error)

GetOS returns the operating system

type ShellType

type ShellType int

ShellType is the type of the shell that is supported

const (
	Bash ShellType = 0
	Zsh  ShellType = 1
	Fish ShellType = 2
	Sh   ShellType = 3
)

func GetShellType

func GetShellType(shellLocation string) ShellType

type SystemConfig

type SystemConfig struct {
	// Out is the output writer for printing information
	Out io.Writer
	// ErrOut is the error output writer for printing errors
	ErrOut io.Writer
}

SystemConfig Configuration that is not available via the configuration file

var SysConfig *SystemConfig

SysConfig is the global system configuration instance

Jump to

Keyboard shortcuts

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