You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/develop/environment-configuration.mdx
+126-1Lines changed: 126 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -381,6 +381,66 @@ main().catch((err) => {
381
381
{/* SNIPEND */}
382
382
383
383
</SdkTabs.TypeScript>
384
+
385
+
<SdkTabs.Java>
386
+
387
+
To load the `default` profile along with any environment variables in Java, use the `ClientConfigProfile.load` method from the `envconfig` package. This method will load the `default` profile from the default location and any environment variables. Environment variables take precedence over the configuration file settings.
388
+
389
+
Then use `profile.toWorkflowServiceStubsOptions` and `profile.toWorkflowClientOptions` to convert the profile to `WorkflowServiceStubsOptions` and `WorkflowClientOptions` respectively. Then use `WorkflowClient.newInstance` to create a Temporal Client.
logger.info(" Server version: {}", systemInfo.getServerVersion());
430
+
431
+
} catch (Exception e) {
432
+
logger.error("❌ Failed to connect: {}", e.getMessage());
433
+
}
434
+
435
+
} catch (Exception e) {
436
+
logger.error("Failed to load configuration: {}", e.getMessage(), e);
437
+
System.exit(1);
438
+
}
439
+
}
440
+
}
441
+
```
442
+
443
+
</SdkTabs.Java>
384
444
</SdkTabs>
385
445
386
446
## Load configuration from a custom path
@@ -674,5 +734,70 @@ main().catch((err) => {
674
734
675
735
</SdkTabs.TypeScript>
676
736
677
-
</SdkTabs>
737
+
<SdkTabs.Java>
738
+
739
+
To load a profile configuration file from a custom path in Java, use the `ClientConfigProfile.load` method from the `envconfig` package with the `ConfigFilePath` parameter. This method will load the profile from the custom path and any environment variables. Environment variables take precedence over the configuration file settings.
0 commit comments