Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds docs for client initialisation with env variables #992

Merged
merged 4 commits into from
Jan 24, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions daprdocs/content/en/java-sdk-docs/java-client/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,31 @@ If you haven't already, [try out one of the quickstarts]({{< ref quickstarts >}}

[Complete initial setup and import the Java SDK into your project]({{< ref java >}})

## Initializing the client
You can initialize a Dapr client as so:

```java
DaprClient client = new DaprClientBuilder().build()
```

This will connect to the default Dapr gRPC endpoint `localhost:50001`.


#### Environment variables:

##### Dapr Sidecar Endpoints
You can use the standardized `DAPR_GRPC_ENDPOINT` and `DAPR_HTTP_ENDPOINT` environment variables to
specify a different gRPC endpoint. When these variables are set, the client will automatically use them to connect to the Dapr sidecar.

The legacy environment variables `DAPR_HTTP_PORT` and `DAPR_GRPC_PORT` are still supported, but `DAPR_GRPC_ENDPOINT` and `DAPR_HTTP_ENDPOINT` take precedence.

##### Dapr API Token
If your Dapr instance is configured to require the `DAPR_API_TOKEN` environment variable, you can
set it in the environment and the client will use it automatically.
You can read more about Dapr API token authentication [here](https://docs.dapr.io/operations/security/api-token/).



## Building blocks

The Java SDK allows you to interface with all of the [Dapr building blocks]({{< ref building-blocks >}}).
Expand Down
Loading