Environment variables

The following table lists the environment variables used by the Dapr runtime, CLI, or from within your application:

Environment VariableUsed ByDescription
APP_IDYour applicationThe id for your application, used for service discovery
APP_PORTDapr sidecar应用程序正在侦听的端口
APP_API_TOKENYour applicationThe token used by the application to authenticate requests from Dapr API. Read authenticate requests from Dapr using token authentication for more information.
DAPR_HTTP_PORTYour applicationThe HTTP port that the Dapr sidecar is listening on. Your application should use this variable to connect to Dapr sidecar instead of hardcoding the port value. Set by the Dapr CLI run command for self-hosted or injected by the dapr-sidecar-injector into all the containers in the pod.
DAPR_GRPC_PORTYour applicationThe gRPC port that the Dapr sidecar is listening on. Your application should use this variable to connect to Dapr sidecar instead of hardcoding the port value. Set by the Dapr CLI run command for self-hosted or injected by the dapr-sidecar-injector into all the containers in the pod.
DAPR_API_TOKENDapr sidecarThe token used for Dapr API authentication for requests from the application. Enable API token authentication in Dapr.
NAMESPACEDapr sidecarUsed to specify a component’s namespace in self-hosted mode.
DAPR_DEFAULT_IMAGE_REGISTRYDapr CLIIn self-hosted mode, it is used to specify the default container registry to pull images from. When its value is set to GHCR or ghcr, it pulls the required images from Github container registry. To default to Docker hub, unset this environment variable.
SSL_CERT_DIRDapr sidecarSpecifies the location where the public certificates for all the trusted certificate authorities (CA) are located. Not applicable when the sidecar is running as a process in self-hosted mode.
DAPR_HELM_REPO_URLYour private Dapr Helm chart urlSpecifies a private Dapr Helm chart url, which defaults to the official Helm chart URL: https://dapr.github.io/helm-charts
DAPR_HELM_REPO_USERNAMEA username for a private Helm chartThe username required to access the private Dapr Helm chart. If it can be accessed publicly, this env variable does not need to be set
DAPR_HELM_REPO_PASSWORDA password for a private Helm chartThe password required to access the private Dapr helm chart. If it can be accessed publicly, this env variable does not need to be set
OTEL_EXPORTER_OTLP_ENDPOINTOpenTelemetry TracingSets the Open Telemetry (OTEL) server address, turns on tracing. (Example: http://localhost:4318)
OTEL_EXPORTER_OTLP_INSECUREOpenTelemetry TracingSets the connection to the endpoint as unencrypted. (true, false)
OTEL_EXPORTER_OTLP_PROTOCOLOpenTelemetry TracingThe OTLP protocol to use Transport protocol. (grpc, http/protobuf, http/json)
DAPR_COMPONENTS_SOCKETS_FOLDERDapr runtime and the .NET, Go, and Java pluggable component SDKsThe location or path where Dapr looks for Pluggable Components Unix Domain Socket files. If unset this location defaults to /tmp/dapr-components-sockets
DAPR_COMPONENTS_SOCKETS_EXTENSION.NET and Java pluggable component SDKsA per-SDK configuration that indicates the default file extension applied to socket files created by the SDKs. Not a Dapr-enforced behavior.
DAPR_PLACEMENT_METADATA_ENABLEDDapr placementEnable an endpoint for the Placement service that exposes placement table information on actor usage. Set to true to enable in self-hosted mode. Learn more about the Placement API
DAPR_HOST_IPDapr sidecarThe host’s chosen IP address. If not specified, will loop over the network interfaces and select the first non-loopback address it finds.
DAPR_HEALTH_TIMEOUTSDKsSets the time on the “wait for sidecar” availability. Overrides the default timeout setting of 60 seconds.