docs
docs copied to clipboard
Environment Variables: Inconsistency between docs & code
Describe the issue
This is an accompanied issue with the unmerged PR https://github.com/dapr/cli/pull/770.
I spotted the inconsistency in following sources:
- Our document
- Env passed by CLI to child apps
- Our Python SDK: global settings
URL of the docs
- Environment variable reference
- Dapr CLI: run command
- Python SDK: global settings. The expected settings are identical with dapr/dapr env_variables.go
Screenshots

To summarize, here are the inconsistencies
Variable | Fact | Note |
---|---|---|
APP_ID | Expected from Python SDK, not defined by docs | |
APP_PORT | Expected from Python SDK, not defined by docs | port of apps, http/grpc depending on mode. |
APP_TOKEN_API | Expected by Doc. dapr/cli does not pass to child apps |
|
DAPR_METRICS_PORT | Not defined by docs. Used by dapr/cli , Python SDK |
|
DAPR_PROFILE_PORT | Expected from Python SDK, not defined by docs | |
DAPR_PLACEMENT_HOST | Expected by docs. dapr/cli does not pass to child apps |
|
DAPR_TOKEN_API | Expected by docs. dapr/cli does not pass to child apps |
|
HOST_ADDRESS | Expected from Python SDK, not defined by docs |
Questions
I want to correct our docs. So please answer following questions
- For expected-but-not-defined variables, what should we do? Define them in docs?
- APP_ID
- APP_PORT
- APP_TOKEN_API
- DAPR_METRICS_PORT
- DAPR_PROFILE_PORT
- HOST_ADDRESS
- For defined-but-not-passed variables, do we need to change
dapr/cli
or just remove them?
- DAPR_PLACEMENT_HOST
- DAPR_TOKEN_API
- If we pass
APP_PORT
, do we need to pass the associatedmode
? Actually I can't find things related tomode
in our documentation. The most resemble to that variable is app-protocol
@yaron2 @mukundansundar @artursouza PTAL
Thanks @anhldbk for writing up this detailed issue. Greatly appreciated IMO
- These are all needed in the docs
- The DAPR_TOKEN_API certainly needs to be passed to the app
- Not sure @yaron2. I do not see why the application would need to know the mode. Do you have a scenario?
@yaron2 How do you think?
DAPR_PLACEMENT_HOST is not in any source code, only docs. This is safe to be deleted from docs. Same for DAPR_TOKEN_API.
APP_PORT is used only by the sidecar and it handles mode correctly.
HOST_ADDRESS is set by CLI but not used anywhere. It should be safe to be removed. DAPR_PROFILE_PORT is set by CLI but not used anywhere. It should be safe to be removed. DAPR_METRICS_PORT is set by CLI but not used anywhere. It should be safe to be removed.
APP_TOKEN_API is document and not used, should be removed.
The environment variables you are referring to are used in Dapr sidecar
Also, see this documentation about K8s annotations and CLI flags: https://docs.dapr.io/reference/arguments-annotations-overview/
LGTM on @artursouza's comment. I'd really like to see a PR for this @anhldbk
@artursouza I propose we should provide definitions for APP_ID, APP_PORT also
To sum up, here are our actions. Is that ok?

@artursouza another question: should we dedicate Environment variables for variables passed to child applications only? There are so many environment variables automatically scoped by Viper.
If yes, we'll remove definition for DAPR_NETWORK, NAMESPACE
DAPR_API_TOKEN and APP_API_TOKEN are validate env variables, they are just spelt wrong in the table here https://docs.dapr.io/reference/environment/ Also APP_ID and APP_PORT should be in the docs
For DAPR_PLACEMENT_HOST, are you sure that the Placement service does not use this on startup if I run the exe myself?
For DAPR_PLACEMENT_HOST, are you sure that the Placement service does not use this on startup if I run the exe myself?
@msfussell @artursouza WDYT?
where there PRs raised here to remove from the CLI?
@msfussell this one: https://github.com/dapr/cli/pull/860
Btw, hi @hhunter-ms. Looks like you will handle this issue
@anhldbk - Looks like this PR kept the env variables such as DAPR_METRIC_PORT. Can you look at this PR and provide feedback https://github.com/dapr/docs/pull/3454 ?
Completed