Documentation
¶
Overview ¶
Package policy provides trust management for project configurations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotInteractive = errors.New("terminal is not interactive")
ErrNotInteractive is returned when a trust prompt is needed but the terminal is not interactive. The caller should skip loading the runtime config.
Functions ¶
This section is empty.
Types ¶
type TrustDecision ¶
type TrustDecision int
TrustDecision represents the user's choice when prompted about an untrusted project.
const ( // TrustDecisionSkip means the user chose to skip loading the runtime config. TrustDecisionSkip TrustDecision = iota // TrustDecisionAllow means the user trusts the project and wants to add it to the trust list. TrustDecisionAllow )
type TrustManager ¶
type TrustManager struct {
// contains filtered or unexported fields
}
TrustManager handles trust decisions for project configurations.
func NewTrustManager ¶
func NewTrustManager(pol *policies.Policy, policyPath string) *TrustManager
NewTrustManager creates a new TrustManager.
func (*TrustManager) LoadTrustedRuntimeConfig ¶
func (m *TrustManager) LoadTrustedRuntimeConfig( targetPath string, prompter TrustPrompter, mode TrustMode, ) (*runtimeconfigs.RuntimeConfig, string, error)
LoadTrustedRuntimeConfig finds and loads a runtime config if it exists and is trusted. Returns nil (not an error) if no runtime config found or if untrusted.
type TrustPrompter ¶
type TrustPrompter interface {
// Prompt prompts the user to decide whether to trust a project configuration.
// Returns [TrustDecision] and any error (including [ErrNotInteractive]).
Prompt(projectDir, configPath string) (TrustDecision, error)
}
TrustPrompter handles interactive trust prompts for project configurations.
Click to show internal directories.
Click to hide internal directories.