Skip to content

Commit 8dacf99

Browse files
refactor: check existence of azure digital twin configuration at the startup of the application
1 parent 15f5b24 commit 8dacf99

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/env/infrastructure/digitaltwins/DigitalTwinManager.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,18 @@ public class DigitalTwinManager implements MedicalTechnologyRepository {
3737

3838
private final DigitalTwinsClient dtClient;
3939

40-
/**
41-
* Default constructor.
42-
*/
43-
public DigitalTwinManager() {
40+
static {
41+
// Checks on existence of environmental variable
4442
Objects.requireNonNull(System.getenv(DT_APP_ID_VARIABLE), "Azure client app id required");
4543
Objects.requireNonNull(System.getenv(DT_TENANT_VARIABLE), "Azure tenant id required");
4644
Objects.requireNonNull(System.getenv(DT_APP_SECRET_VARIABLE), "Azure client secret id required");
4745
Objects.requireNonNull(System.getenv(DT_ENDPOINT_VARIABLE), "Azure dt endpoint required");
46+
}
47+
48+
/**
49+
* Default constructor.
50+
*/
51+
public DigitalTwinManager() {
4852
this.dtClient = new DigitalTwinsClientBuilder()
4953
.credential(new DefaultAzureCredentialBuilder().build())
5054
.endpoint(System.getenv(DT_ENDPOINT_VARIABLE))

0 commit comments

Comments
 (0)