envconfig

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package envconfig owns every environment variable the agent reads. Each name has a Key* constant; accessors re-read on every call so flags can flip without a restart. System env vars (PATH, KUBECONFIG, ...) stay at callsites.

Index

Constants

View Source
const (
	KeyAPIKey    = "PDCP_API_KEY"
	KeyTeamID    = "PDCP_TEAM_ID"
	KeyAPIServer = "PDCP_API_SERVER"
	KeyUpdateURL = "PDCP_UPDATE_URL"

	DefaultAPIServer = "https://api.projectdiscovery.io"
)
View Source
const (
	KeyAgentName       = "PDCP_AGENT_NAME"
	KeyAgentNetwork    = "PDCP_AGENT_NETWORK"
	KeyAgentNetworkAlt = "AGENT_NETWORK" // legacy alias; PDCP_AGENT_NETWORK wins
	KeyAgentOutput     = "PDCP_AGENT_OUTPUT"

	DefaultAgentNetwork = "default"
)
View Source
const (
	KeyChunkParallelism = "PDCP_CHUNK_PARALLELISM"
	KeyScanParallelism  = "PDCP_SCAN_PARALLELISM"

	DefaultScanParallelism = "1"
)
View Source
const (
	KeyAgentDBDir         = "PDCP_AGENTDB_DIR"
	KeyAgentDBLogCapMB    = "PDCP_AGENTDB_LOG_CAP_MB"
	KeyAgentDBMetricCapMB = "PDCP_AGENTDB_METRIC_CAP_MB"
)
View Source
const (
	KeyVerbose                 = "PDCP_VERBOSE"
	KeyKeepOutputFiles         = "PDCP_KEEP_OUTPUT_FILES"
	KeyLocalK8s                = "LOCAL_K8S"
	KeyDisableDiagnosticUpload = "PDCP_DISABLE_DIAGNOSTIC_UPLOAD"
	KeyEnableScanLogUpload     = "PDCP_ENABLE_SCAN_LOG_UPLOAD"
	KeyRequireAllTemplates     = "PDCP_REQUIRE_ALL_TEMPLATES"
)
View Source
const (
	KeyScanLogS3Bucket       = "PDCP_SCAN_LOG_S3_BUCKET"
	KeyScanLogS3Region       = "PDCP_SCAN_LOG_S3_REGION"
	KeyScanLogS3AccessKeyID  = "PDCP_SCAN_LOG_S3_ACCESS_KEY_ID"
	KeyScanLogS3SecretKey    = "PDCP_SCAN_LOG_S3_SECRET_ACCESS_KEY"
	KeyScanLogS3Endpoint     = "PDCP_SCAN_LOG_S3_ENDPOINT"
	KeyScanLogS3UsePathStyle = "PDCP_SCAN_LOG_S3_USE_PATH_STYLE"
	KeyScanLogS3Prefix       = "PDCP_SCAN_LOG_S3_PREFIX"

	DefaultScanLogS3Prefix = "scan-logs"
)
View Source
const KeyGitHubToken = "GITHUB_TOKEN"

KeyGitHubToken is read by projectdiscovery/utils/update for every nuclei-templates download; the agent reuses it for the release lookup so a fleet shares one 5000/hr budget instead of 60/hr per NAT egress IP.

View Source
const KeyMetricsAddr = "PDCP_METRICS_ADDR"
View Source
const KeyProxyURL = "PROXY_URL"
View Source
const KeyReportingConfig = "PDCP_REPORTING_CONFIG"

Variables

This section is empty.

Functions

func APIKey

func APIKey() string

APIKey returns the PDCP API key.

func APIServer

func APIServer() string

APIServer returns the platform API base URL.

func AgentDBDir

func AgentDBDir() string

AgentDBDir overrides the local observability DB directory.

func AgentDBLogCapMB

func AgentDBLogCapMB() string

AgentDBLogCapMB returns the log ring-buffer cap in MB.

func AgentDBMetricCapMB

func AgentDBMetricCapMB() string

AgentDBMetricCapMB returns the metric ring-buffer cap in MB.

func AgentName

func AgentName() string

AgentName returns the agent-name override.

func AgentNetwork

func AgentNetwork() string

AgentNetwork returns PDCP_AGENT_NETWORK.

func AgentNetworkLegacy

func AgentNetworkLegacy() string

AgentNetworkLegacy returns the older AGENT_NETWORK alias.

func AgentNetworkLegacyOrDefault

func AgentNetworkLegacyOrDefault() string

AgentNetworkLegacyOrDefault returns AGENT_NETWORK or DefaultAgentNetwork.

func AgentOutput

func AgentOutput() string

AgentOutput returns the output-directory override.

func ChunkParallelism

func ChunkParallelism() string

ChunkParallelism returns the raw value; empty means auto-detect.

func DisableDiagnosticUpload

func DisableDiagnosticUpload() bool

DisableDiagnosticUpload disables shipping the SQLite DB to GCS at shutdown.

func GitHubToken added in v0.2.1

func GitHubToken() string

GitHubToken returns GITHUB_TOKEN; empty means unauthenticated GitHub access.

func KeepOutputFiles

func KeepOutputFiles() bool

KeepOutputFiles preserves per-chunk output files after upload.

func LocalK8s

func LocalK8s() bool

LocalK8s switches to KUBECONFIG instead of the in-cluster service account. Strict "true" match: ParseBool would let LOCAL_K8S=1 flip to a path that fails silently when KUBECONFIG is unset.

func MetricsAddr

func MetricsAddr() string

MetricsAddr returns the Prometheus bind address; empty disables the server.

func ProxyURL

func ProxyURL() string

ProxyURL returns the outbound HTTP/S proxy URL.

func ReportingConfigPath

func ReportingConfigPath() string

ReportingConfigPath returns a local nuclei -rc YAML path. When set, it overrides the reporting config in the work message, keeping tracker credentials off the platform.

func RequireAllTemplates added in v0.2.1

func RequireAllTemplates() bool

RequireAllTemplates fails a chunk outright when any requested template cannot be resolved, instead of dropping it and scanning the rest.

Off by default, and not for lack of caution: nuclei's loader logs "Could not find template" for an entry it cannot resolve and then scans the rest anyway (catalog/loader.logErroredTemplates), so aborting the chunk prevents no partial scan. It only discards the coverage that did resolve. Turn it on where a partial result reported as complete is the worse outcome.

func ScanLogS3AccessKeyID added in v0.2.1

func ScanLogS3AccessKeyID() string

ScanLogS3AccessKeyID returns the static access key id.

func ScanLogS3Bucket added in v0.2.1

func ScanLogS3Bucket() string

ScanLogS3Bucket returns the customer-owned bucket. Empty disables the destination, so this one key decides whether the others are read at all.

func ScanLogS3Endpoint added in v0.2.1

func ScanLogS3Endpoint() string

ScanLogS3Endpoint overrides the endpoint for S3-compatible storage. Empty lets the SDK resolve the regional AWS endpoint; a derived-but-blank host is how you end up requesting https://.example.com.

func ScanLogS3Prefix added in v0.2.1

func ScanLogS3Prefix() string

ScanLogS3Prefix returns the key prefix scan logs are written under.

func ScanLogS3Region added in v0.2.1

func ScanLogS3Region() string

ScanLogS3Region returns the bucket region. Required alongside a bucket: SigV4 binds the region into the signature, so a wrong or empty one fails every request rather than degrading.

func ScanLogS3SecretKey added in v0.2.1

func ScanLogS3SecretKey() string

ScanLogS3SecretKey returns the static secret access key.

func ScanLogS3UsePathStyle added in v0.2.1

func ScanLogS3UsePathStyle() bool

ScanLogS3UsePathStyle addresses buckets as <endpoint>/<bucket> instead of <bucket>.<endpoint>. Needed by MinIO and most in-cluster stores, where the per-bucket hostname does not resolve.

func ScanLogUploadEnabled

func ScanLogUploadEnabled() bool

ScanLogUploadEnabled is off by default so agents without scan-log storage provisioned don't hammer the API with rejected uploads.

func ScanParallelism

func ScanParallelism() string

ScanParallelism returns PDCP_SCAN_PARALLELISM or "1".

func TeamID

func TeamID() string

TeamID returns the PDCP team identifier.

func UpdateURL

func UpdateURL() string

UpdateURL overrides the self-update download URL; empty resolves via GitHub releases.

func Verbose

func Verbose() bool

Verbose returns true when PDCP_VERBOSE is truthy.

Types

This section is empty.

Jump to

Keyboard shortcuts

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