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
- func APIKey() string
- func APIServer() string
- func AgentDBDir() string
- func AgentDBLogCapMB() string
- func AgentDBMetricCapMB() string
- func AgentName() string
- func AgentNetwork() string
- func AgentNetworkLegacy() string
- func AgentNetworkLegacyOrDefault() string
- func AgentOutput() string
- func ChunkParallelism() string
- func DisableDiagnosticUpload() bool
- func GitHubToken() string
- func KeepOutputFiles() bool
- func LocalK8s() bool
- func MetricsAddr() string
- func ProxyURL() string
- func ReportingConfigPath() string
- func RequireAllTemplates() bool
- func ScanLogS3AccessKeyID() string
- func ScanLogS3Bucket() string
- func ScanLogS3Endpoint() string
- func ScanLogS3Prefix() string
- func ScanLogS3Region() string
- func ScanLogS3SecretKey() string
- func ScanLogS3UsePathStyle() bool
- func ScanLogUploadEnabled() bool
- func ScanParallelism() string
- func TeamID() string
- func UpdateURL() string
- func Verbose() bool
Constants ¶
const ( KeyAPIKey = "PDCP_API_KEY" KeyTeamID = "PDCP_TEAM_ID" KeyAPIServer = "PDCP_API_SERVER" KeyUpdateURL = "PDCP_UPDATE_URL" DefaultAPIServer = "https://api.projectdiscovery.io" )
const ( KeyAgentName = "PDCP_AGENT_NAME" KeyAgentNetwork = "PDCP_AGENT_NETWORK" KeyAgentNetworkAlt = "AGENT_NETWORK" // legacy alias; PDCP_AGENT_NETWORK wins KeyAgentOutput = "PDCP_AGENT_OUTPUT" DefaultAgentNetwork = "default" )
const ( KeyChunkParallelism = "PDCP_CHUNK_PARALLELISM" KeyScanParallelism = "PDCP_SCAN_PARALLELISM" DefaultScanParallelism = "1" )
const ( KeyAgentDBDir = "PDCP_AGENTDB_DIR" KeyAgentDBLogCapMB = "PDCP_AGENTDB_LOG_CAP_MB" KeyAgentDBMetricCapMB = "PDCP_AGENTDB_METRIC_CAP_MB" )
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" )
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" )
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.
const KeyMetricsAddr = "PDCP_METRICS_ADDR"
const KeyProxyURL = "PROXY_URL"
const KeyReportingConfig = "PDCP_REPORTING_CONFIG"
Variables ¶
This section is empty.
Functions ¶
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 AgentNetworkLegacy ¶
func AgentNetworkLegacy() string
AgentNetworkLegacy returns the older AGENT_NETWORK alias.
func AgentNetworkLegacyOrDefault ¶
func AgentNetworkLegacyOrDefault() string
AgentNetworkLegacyOrDefault returns AGENT_NETWORK or DefaultAgentNetwork.
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 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".
Types ¶
This section is empty.