envconfig

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 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"
)
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 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 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