config

package
v1.11.3 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const LegacyDirName = ".stepsecurity"

LegacyDirName is the basename of the per-user agent directory under $HOME. config.json always lives here so the agent can bootstrap; other files (logs, hook errors, the binary) may be relocated via the resolved install dir — see internal/paths.

Variables

View Source
var (
	CustomerID         = "{{CUSTOMER_ID}}"
	APIEndpoint        = "{{API_ENDPOINT}}"
	APIKey             = "{{API_KEY}}"
	ScanFrequencyHours = "{{SCAN_FREQUENCY_HOURS}}"
	SearchDirs         []string
	EnableNPMScan      *bool  // nil=auto
	EnableBrewScan     *bool  // nil=auto
	EnablePythonScan   *bool  // nil=auto
	ColorMode          string // "" means auto
	OutputFormat       string // "" means default (pretty)
	HTMLOutputFile     string // "" means not set
	LogLevel           string // "" means default (info); one of error/warn/info/debug
	InstallDir         string // "" means default (~/.stepsecurity); non-empty makes the agent put all its files (logs, hook errors, future state) under this directory. Bootstrap config.json itself stays at the legacy location. Per-run opt-out is the CLI flag --install-dir=. Resolution: --install-dir flag > STEPSECURITY_HOME env > this field > default — see internal/paths.
)

Default placeholders (replaced by backend for enterprise installation scripts).

Functions

func ConfigFilePath

func ConfigFilePath() string

ConfigFilePath returns the path to the config file (read-preferred).

func IsEnterpriseMode

func IsEnterpriseMode() bool

IsEnterpriseMode returns true if valid enterprise credentials are configured.

func LegacyDir added in v1.11.3

func LegacyDir() string

LegacyDir returns the per-user agent directory (~/.stepsecurity), used as the reference point for the install-dir migration warning in main: if the operator has moved the install dir but this directory still holds diagnostic files, the agent surfaces a heads-up. Returns "" when $HOME can't be resolved.

Distinct from ConfigFilePath / WriteConfigFilePath above: those follow the machine-vs-user resolution that lets MSI-deployed installs share config with a scheduled task running as a logged-in user. LegacyDir is always per-user, regardless of elevation.

func Load

func Load()

Load reads the config file and applies values to the package-level variables. Values already set (not placeholders) are not overridden — build-time values take precedence.

func RunConfigure

func RunConfigure() error

RunConfigure interactively prompts for config values and saves to the config file.

func RunConfigureNonInteractive added in v1.11.3

func RunConfigureNonInteractive(opts NonInteractiveOptions) error

RunConfigureNonInteractive applies the supplied options to the existing on-disk config and saves. Designed for MSI custom actions, CI, and any orchestrator that can't drive stdin prompts. Always writes to writeConfigDir() — so an MSI running as SYSTEM lands config under C:\ProgramData\StepSecurity where the scheduled task (running as the logged-in user) can read it.

func ShowConfigure

func ShowConfigure()

ShowConfigure prints the current configuration to stdout.

func WriteConfigFilePath added in v1.11.3

func WriteConfigFilePath() string

WriteConfigFilePath returns the path config would be written to under the current process's privilege level. Surfaced so `configure show` / install messages can name the exact file the next save will touch.

Types

type ConfigFile

type ConfigFile struct {
	CustomerID         string   `json:"customer_id,omitempty"`
	APIEndpoint        string   `json:"api_endpoint,omitempty"`
	APIKey             string   `json:"api_key,omitempty"`
	ScanFrequencyHours string   `json:"scan_frequency_hours,omitempty"`
	SearchDirs         []string `json:"search_dirs,omitempty"`
	EnableNPMScan      *bool    `json:"enable_npm_scan,omitempty"`
	EnableBrewScan     *bool    `json:"enable_brew_scan,omitempty"`
	EnablePythonScan   *bool    `json:"enable_python_scan,omitempty"`
	ColorMode          string   `json:"color_mode,omitempty"`
	OutputFormat       string   `json:"output_format,omitempty"`
	HTMLOutputFile     string   `json:"html_output_file,omitempty"`
	LogLevel           string   `json:"log_level,omitempty"`
	InstallDir         string   `json:"install_dir,omitempty"`
}

ConfigFile is the JSON structure persisted to ~/.stepsecurity/config.json.

type NonInteractiveOptions added in v1.11.3

type NonInteractiveOptions struct {
	FromFile      string   // path to a complete ConfigFile JSON; wins over inline values
	CustomerID    string   // --customer-id
	APIEndpoint   string   // --api-endpoint
	APIKey        string   // --api-key (or DMG_API_KEY env)
	ScanFrequency string   // --scan-frequency (hours, as string)
	SearchDirs    []string // --search-dirs (re-used from scan flag; empty = unchanged)
}

NonInteractiveOptions captures every input the non-interactive configure path accepts. Populated by main.go from cli.Config plus the DMG_API_KEY env var fallback. Empty fields preserve the existing on-disk value (merge semantics — same as the interactive prompt's "press Enter to keep").

func (NonInteractiveOptions) HasAny added in v1.11.3

func (o NonInteractiveOptions) HasAny() bool

HasAny reports whether the caller supplied any inline value. Used by main.go to decide whether `configure` was invoked non-interactively even without the explicit --non-interactive flag (e.g. an MSI that only passes --from-file).

Jump to

Keyboard shortcuts

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