Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetSharedConfig ¶
func SetSharedConfig(ctx context.Context, c SharedConfig) context.Context
Types ¶
type Config ¶
type Config struct {
// API Keys (optional, increase rate limits)
NVDAPIKey string `env:"NVD_API_KEY" envDefault:""`
GitHubToken string `env:"GITHUB_TOKEN" envDefault:""`
// Cache Configuration
CacheBackend string `env:"CACHE_BACKEND" envDefault:"filesystem"`
CacheMaxAgeDays int `env:"HTTP_CACHE_MAX_AGE_DAYS" envDefault:"2"`
MetadataBackend string `env:"METADATA_BACKEND" envDefault:"filesystem"`
BackendGCSBucket string `env:"BACKEND_GCS_BUCKET" envDefault:""`
KeyPrefix string `env:"GCS_PREFIX" envDefault:"v3"`
HTTPGCSBucket string `env:"HTTP_GCS_BUCKET" envDefault:""`
HTTPGCSPrefix string `env:"HTTP_GCS_PREFIX" envDefault:"v1"`
ValkeyURL string `env:"VALKEY_URL" envDefault:"redis://localhost:6379"`
// HIGH_MEM_SERVER is the URL of a high-memory server running the /artifact endpoint.
// When set, artifact extraction is delegated to this server instead of running locally.
// No default: the open-source CLI extracts locally; only the hosted server sets this.
HighMemServer string `env:"HIGH_MEM_SERVER" envDefault:""`
// HIGH_MEM_AUDIENCE is the audience for ID token authentication.
// Defaults to "risk-guard-api" which is configured as a custom audience on the Cloud Run service.
HighMemAudience string `env:"HIGH_MEM_AUDIENCE" envDefault:"risk-guard-api"`
GoogleCloudProject string `env:"GOOGLE_CLOUD_PROJECT" envDefault:""`
ScorePackageWorkflow string `env:"SCORE_PACKAGE_WORKFLOW" envDefault:""`
ScoreSourceWorkflow string `env:"SCORE_SOURCE_WORKFLOW" envDefault:""`
ScoreDepsWorkflow string `env:"SCORE_DEPS_WORKFLOW" envDefault:""`
ServiceName string `env:"SERVICE_NAME" envDefault:"risk-guard"`
SecureGit bool `env:"SECURE_GIT" envDefault:"false"`
CloneTimeoutSeconds int `env:"CLONE_TIMEOUT_SECONDS" envDefault:"30"`
}
Config holds all validated environment variables for Risk Guard. This provides type-safe access to configuration with validation and prevents runtime errors from missing or invalid environment variables.
func Load ¶
Load validates and returns environment configuration. It automatically loads .env file if present in the current directory. Returns an error if any validation fails.
func (*Config) GetCacheMaxAge ¶
GetCacheMaxAge returns the cache max age as a time.Duration.
func (*Config) GetCloneTimeout ¶ added in v0.1.0
GetCloneTimeout returns the per-git-clone timeout. A value <= 0 falls back to the default.
func (*Config) GetHighMemAudience ¶
func (*Config) GetHighMemServer ¶
func (*Config) GetSecureGit ¶
type SharedConfig ¶
type SharedConfig interface {
}
SharedConfig is the minimal config contract used by code shared between the local CLI and the server. Each binary supplies its own implementation.
func GetSharedConfig ¶
func GetSharedConfig(ctx context.Context) SharedConfig
GetSharedConfig retrieves the shared config from the context. Panics if missing to enforce initialization in the root command.