settings

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultResolverTimeout is the default timeout for individual resolver execution.
	DefaultResolverTimeout = 30 * time.Second

	// DefaultPhaseTimeout is the default timeout for resolver phase execution.
	DefaultPhaseTimeout = 5 * time.Minute

	// DefaultActionTimeout is the default timeout for action execution.
	DefaultActionTimeout = 5 * time.Minute

	// DefaultGracePeriod is the default grace period for action cancellation.
	DefaultGracePeriod = 30 * time.Second
)

Timeout defaults

View Source
const (
	// DefaultHTTPTimeout is the default timeout for HTTP requests.
	DefaultHTTPTimeout = 30 * time.Second

	// DefaultHTTPRetryMax is the default maximum number of HTTP retries.
	DefaultHTTPRetryMax = 3

	// DefaultHTTPRetryWaitMinimum is the minimum wait time between HTTP retries.
	DefaultHTTPRetryWaitMinimum = 1 * time.Second

	// DefaultHTTPRetryWaitMaximum is the maximum wait time between HTTP retries.
	DefaultHTTPRetryWaitMaximum = 30 * time.Second

	// DefaultHTTPCacheTTL is the default TTL for HTTP cache entries.
	DefaultHTTPCacheTTL = 10 * time.Minute

	// DefaultHTTPCacheKeyPrefix is the default prefix for HTTP cache keys.
	DefaultHTTPCacheKeyPrefix = "scafctl:"
)

HTTP client defaults

View Source
const (
	// DefaultMaxCacheFileSize is the maximum size for a single cached file (10MB).
	DefaultMaxCacheFileSize = 10 * 1024 * 1024

	// DefaultMemoryCacheSize is the maximum number of entries in memory caches.
	DefaultMemoryCacheSize = 1000

	// DefaultWarnValueSize is the threshold for warning about large resolver values (1MB).
	DefaultWarnValueSize = 1024 * 1024

	// DefaultMaxValueSize is the maximum allowed resolver value size (10MB).
	DefaultMaxValueSize = 10 * 1024 * 1024
)

Size limits

View Source
const (
	// DefaultCELCacheSize is the default size for the CEL program cache.
	DefaultCELCacheSize = 10000

	// DefaultCELCostLimit is the default cost limit for CEL expression evaluation.
	// Set to 0 to disable cost limiting.
	DefaultCELCostLimit = 1000000
)

CEL defaults

View Source
const (
	// DefaultCircuitBreakerMaxFailures is the number of consecutive failures before opening the circuit.
	DefaultCircuitBreakerMaxFailures = 5

	// DefaultCircuitBreakerOpenTimeout is how long to wait before transitioning from Open to HalfOpen.
	DefaultCircuitBreakerOpenTimeout = 30 * time.Second

	// DefaultCircuitBreakerHalfOpenRequests is the number of successful requests in HalfOpen before closing.
	DefaultCircuitBreakerHalfOpenRequests = 1
)

Circuit breaker defaults

View Source
const (
	CliBinaryName = "scafctl"
)

Variables

View Source
var (
	RootSolutionFolders = []string{
		CliBinaryName,
		fmt.Sprintf(".%s", CliBinaryName),
		"",
	}
	SolutionFileNames = []string{
		"solution.yaml",
		"solution.yml",
		fmt.Sprintf("%s.yaml", CliBinaryName),
		fmt.Sprintf("%s.yml", CliBinaryName),
		"solution.json",
		fmt.Sprintf("%s.json", CliBinaryName),
	}
)
View Source
var VersionInformation = VersionInfo{
	Commit:       "unknown",
	BuildVersion: "v0.0.0-nightly",
	BuildTime:    "unknown",
}

Functions

func DefaultHTTPCacheDir

func DefaultHTTPCacheDir() string

DefaultHTTPCacheDir returns the default directory for HTTP cache. Uses XDG Base Directory Specification:

  • Linux: ~/.cache/scafctl/http-cache/
  • macOS: ~/.cache/scafctl/http-cache/
  • Windows: %LOCALAPPDATA%\cache\scafctl\http-cache\

func IntoContext

func IntoContext(ctx context.Context, s *Run) context.Context

IntoContext stores a Settings object in the context

Types

type EntryPointSettings

type EntryPointSettings struct {
	FromAPI bool
	FromCli bool
	Path    string
}

EntryPointSettings holds configuration options for determining the entry point source. It specifies whether the entry point is provided via an API or CLI, and the path to the entry point.

type Run

type Run struct {
	MinLogLevel        string
	EntryPointSettings EntryPointSettings
	IsQuiet            bool
	NoColor            bool
	ExitOnError        bool
}

Run holds configuration settings for a single execution of the application. It includes options for logging, entry point configuration, output formatting, and error handling behavior.

func FromContext

func FromContext(ctx context.Context) (*Run, bool)

FromContext retrieves a Settings object from the context

func NewCliParams

func NewCliParams() *Run

NewCliParams initializes and returns a pointer to a Run struct with default CLI parameters. It sets logging level to "none" (no structured logs by default), configures entry point settings for CLI usage, and sets default flags for quiet mode, color output, and error handling.

type VersionInfo

type VersionInfo struct {
	Commit       string
	BuildVersion string
	BuildTime    string
}

VersionInfo holds metadata about the build, including the commit hash, build version, and build timestamp.

Jump to

Keyboard shortcuts

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