mirror of
https://github.com/safedep/pmg.git
synced 2026-08-03 07:24:09 +02:00
feat: Add config support for UI verbosity level (#175)
* feat: Add config support for UI verbosity level * docs: Add verbosity info in UI doc
This commit is contained in:
@@ -14,6 +14,11 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
// Verbosity level constants for the config file
|
||||
VerbositySilent = "silent"
|
||||
VerbosityNormal = "normal"
|
||||
VerbosityVerbose = "verbose"
|
||||
|
||||
// Environment variable key for the insecure installation flag
|
||||
pmgInsecureInstallationEnvKey = "PMG_INSECURE_INSTALLATION"
|
||||
|
||||
@@ -64,6 +69,9 @@ type Config struct {
|
||||
// we initially introduced it as an experimental feature.
|
||||
ExperimentalProxyMode bool `mapstructure:"experimental_proxy_mode"`
|
||||
|
||||
// Verbosity controls the UI verbosity level. Valid values: "silent", "normal", "verbose".
|
||||
Verbosity string `mapstructure:"verbosity"`
|
||||
|
||||
// Sandbox enables sandboxing of package manager processes with controlled filesystem,
|
||||
// network, and process execution access. Provides defense-in-depth against supply chain attacks.
|
||||
Sandbox SandboxConfig `mapstructure:"sandbox"`
|
||||
@@ -211,6 +219,7 @@ func DefaultConfig() RuntimeConfig {
|
||||
ExperimentalProxyMode: false,
|
||||
TrustedPackages: []TrustedPackage{},
|
||||
ProxyMode: true,
|
||||
Verbosity: VerbosityNormal,
|
||||
Sandbox: SandboxConfig{
|
||||
Enabled: false,
|
||||
EnforceAlways: false,
|
||||
|
||||
@@ -10,6 +10,12 @@ transitive_depth: 5
|
||||
# Include dev dependencies in the dependency graph. Default is false.
|
||||
include_dev_dependencies: false
|
||||
|
||||
# UI verbosity level. Valid values: silent, normal, verbose. Default is normal.
|
||||
# silent: PMG is hidden from the user except for errors and malicious package detection
|
||||
# normal: Show minimal status updates
|
||||
# verbose: Show verbose status updates and detailed information
|
||||
verbosity: normal
|
||||
|
||||
# Enable paranoid mode. In paranoid mode, PMG will treat suspicious packages
|
||||
# as malicious packages
|
||||
paranoid: false
|
||||
|
||||
@@ -54,6 +54,7 @@ func TestTemplateMatchesDefaults(t *testing.T) {
|
||||
assert.Equal(t, def.Paranoid, parsed.Paranoid, "paranoid mismatch")
|
||||
assert.Equal(t, def.SkipEventLogging, parsed.SkipEventLogging, "skip_event_logging mismatch")
|
||||
assert.Equal(t, def.EventLogRetentionDays, parsed.EventLogRetentionDays, "event_log_retention_days mismatch")
|
||||
assert.Equal(t, def.Verbosity, parsed.Verbosity, "verbosity mismatch")
|
||||
|
||||
assert.NotEmpty(t, parsed.TrustedPackages, "expected at least one trusted_packages entry")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user