user

package
v0.2.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	YesUpdate string = "Yes, update to new configuration"
	NoKeep    string = "No, keep the existing configuration"
)

TODO: set up localization engine for these strings.

Variables

This section is empty.

Functions

func CompareConfig

func CompareConfig(existingConf, currentConf *Config) (bool, []string)

CompareConfig compares two configuration structs and returns a boolean indicating if there are differences, along with a slice of strings describing what those differences are.

func ConfigureUserSystemInfo

func ConfigureUserSystemInfo(currentConf *Config)

ConfigureUserSystemInfo configures the user system information and prompts the user to update the configuration if necessary.

func GetStoragePath

func GetStoragePath(os config.OSType, home string) (string, error)

GetStoragePath returns the path to the devzero storage directory based on the operating system

func InsertConfig

func InsertConfig(osConfig Config) error

InsertConfig inserts Config used to configure the system

func ReadDZCliConfig

func ReadDZCliConfig(path string) (collector.AuthConfig, error)

ReadDZCliConfig reads the DevZero workspace configuration

func ReadDZWorkspaceConfig

func ReadDZWorkspaceConfig() (collector.AuthConfig, error)

ReadDZWorkspaceConfig reads the DevZero workspace configuration

func UpdateConfig

func UpdateConfig(osConfig Config) error

UpdateConfig updates an existing Config record in the database

Types

type Config

type Config struct {
	Id int64 `json:"id" db:"id"`
	// OS is the operating system
	Os int64 `json:"os" db:"os"`
	// OsName is the operating system name
	OsName string `json:"os_name" db:"os_name"`
	// HomeDir is the user home directory
	HomeDir string `json:"home_dir" db:"home_dir"`
	// LdaDir is the home LDA directory where all configurations are stored.
	LdaDir string `json:"lda_dir" db:"lda_dir"`
	// IsRoot is a value to check if the user is root
	IsRoot bool `json:"is_root" db:"is_root"`
	// ExePath is the path to the lda binary
	ExePath string `json:"exe_path" db:"exe_path"`
	// ShellTypeToLocation is a map of shell type to location
	ShellTypeToLocation map[config.ShellType]string `json:"shell_type_to_location" db:"shell_type_to_location"`
	// User is the user that executed the command (if sudo)
	User *user.User `json:"-" db:"-"`
}

Config is the basic configuration for the system

var Conf *Config

func GetConfig

func GetConfig() (*Config, error)

GetConfig fetches Config used to configure the system

Jump to

Keyboard shortcuts

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