Skip to content

Commit 7fb37f8

Browse files
author
Behnam Mozafari
committed
Revert "Update operator config endpoint to read file path from env variable"
This reverts commit fbabd23.
1 parent 06d78ff commit 7fb37f8

File tree

10 files changed

+14
-31
lines changed

10 files changed

+14
-31
lines changed

src/main/java/com/uid2/core/Const.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ public class Config extends com.uid2.shared.Const.Config {
1616
public static final String KmsAccessKeyIdProp = "kms_aws_access_key_id";
1717
public static final String KmsSecretAccessKeyProp = "kms_aws_secret_access_key";
1818
public static final String KmsEndpointProp = "kms_aws_endpoint";
19-
public static final String OperatorConfigPathProp = "operator_config_path";
2019
}
2120

2221
public static final String OPERATOR_CONFIG_PATH = "conf/operator-config.json";

src/main/java/com/uid2/core/Main.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@
5050
import java.lang.management.ManagementFactory;
5151
import java.util.*;
5252

53-
import static com.uid2.core.Const.Config.OperatorConfigPathProp;
54-
import static com.uid2.core.Const.OPERATOR_CONFIG_PATH;
55-
5653
public class Main {
5754

5855
private static final int vertxServiceInstances = 1;
@@ -165,12 +162,8 @@ public static void main(String[] args) {
165162
);
166163

167164
JwtService jwtService = new JwtService(config);
168-
169165
FileSystem fileSystem = vertx.fileSystem();
170-
171-
String operatorConfigPath = config.getString(OperatorConfigPathProp, OPERATOR_CONFIG_PATH);
172-
173-
coreVerticle = new CoreVerticle(cloudStorage, operatorKeyProvider, attestationService, attestationTokenService, enclaveIdProvider, operatorJWTTokenProvider, jwtService, cloudEncryptionKeyProvider, fileSystem, operatorConfigPath);
166+
coreVerticle = new CoreVerticle(cloudStorage, operatorKeyProvider, attestationService, attestationTokenService, enclaveIdProvider, operatorJWTTokenProvider, jwtService, cloudEncryptionKeyProvider, fileSystem);
174167
} catch (Exception e) {
175168
System.out.println("failed to initialize core verticle: " + e.getMessage());
176169
System.exit(-1);

src/main/java/com/uid2/core/vertx/CoreVerticle.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ public class CoreVerticle extends AbstractVerticle {
8383
private final RotatingCloudEncryptionKeyProvider cloudEncryptionKeyProvider;
8484

8585
private final FileSystem fileSystem;
86-
private final String operatorConfigPath;
8786

8887
public CoreVerticle(ICloudStorage cloudStorage,
8988
IAuthorizableProvider authProvider,
@@ -93,7 +92,7 @@ public CoreVerticle(ICloudStorage cloudStorage,
9392
OperatorJWTTokenProvider operatorJWTTokenProvider,
9493
JwtService jwtService,
9594
RotatingCloudEncryptionKeyProvider cloudEncryptionKeyProvider,
96-
FileSystem fileSystem, String operatorConfigPath) throws Exception {
95+
FileSystem fileSystem) throws Exception {
9796
this.operatorJWTTokenProvider = operatorJWTTokenProvider;
9897
this.healthComponent.setHealthStatus(false, "not started");
9998

@@ -106,7 +105,6 @@ public CoreVerticle(ICloudStorage cloudStorage,
106105
this.cloudEncryptionKeyProvider = cloudEncryptionKeyProvider;
107106

108107
this.fileSystem = fileSystem;
109-
this.operatorConfigPath = operatorConfigPath;
110108

111109
final String jwtAudience = ConfigStore.Global.get(Const.Config.CorePublicUrlProp);
112110
final String jwtIssuer = ConfigStore.Global.get(Const.Config.CorePublicUrlProp);
@@ -140,8 +138,8 @@ public CoreVerticle(ICloudStorage cloudStorage,
140138
IEnclaveIdentifierProvider enclaveIdentifierProvider,
141139
OperatorJWTTokenProvider jwtTokenProvider,
142140
JwtService jwtService,
143-
FileSystem fileSystem, String operatorConfigPath) throws Exception {
144-
this(cloudStorage, authorizableProvider, attestationService, attestationTokenService, enclaveIdentifierProvider, jwtTokenProvider, jwtService, null, fileSystem, operatorConfigPath);
141+
FileSystem fileSystem) throws Exception {
142+
this(cloudStorage, authorizableProvider, attestationService, attestationTokenService, enclaveIdentifierProvider, jwtTokenProvider, jwtService, null, fileSystem);
145143
}
146144

147145
@Override
@@ -211,7 +209,7 @@ private Router createRoutesSetup() {
211209
}
212210

213211
private void handleGetConfig(RoutingContext rc) {
214-
fileSystem.readFile(operatorConfigPath, ar -> {
212+
fileSystem.readFile(com.uid2.core.Const.OPERATOR_CONFIG_PATH, ar -> {
215213
if (ar.succeeded()) {
216214
try {
217215
String fileContent = ar.result().toString();

src/test/java/com/uid2/core/vertx/TestClientSideKeypairMetadataPath.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
import static org.mockito.ArgumentMatchers.any;
4141
import static org.mockito.ArgumentMatchers.eq;
4242
import static org.mockito.Mockito.when;
43-
import static com.uid2.core.Const.OPERATOR_CONFIG_PATH;
4443

4544
@ExtendWith(VertxExtension.class)
4645
public class TestClientSideKeypairMetadataPath {
@@ -76,7 +75,7 @@ void deployVerticle(Vertx vertx, VertxTestContext testContext) throws Throwable
7675
fileSystem = vertx.fileSystem();
7776
SecretStore.Global.load(((JsonObject) Json.decodeValue(openFile("/com.uid2.core/testGlobalMetadata/test-secrets.json"))));
7877
MockitoAnnotations.initMocks(this);
79-
CoreVerticle verticle = new CoreVerticle(cloudStorage, authProvider, attestationService, attestationTokenService, enclaveIdentifierProvider, operatorJWTTokenProvider, jwtService, fileSystem, OPERATOR_CONFIG_PATH);
78+
CoreVerticle verticle = new CoreVerticle(cloudStorage, authProvider, attestationService, attestationTokenService, enclaveIdentifierProvider, operatorJWTTokenProvider, jwtService, fileSystem);
8079
vertx.deployVerticle(verticle, testContext.succeeding(id -> testContext.completeNow()));
8180
}
8281

src/test/java/com/uid2/core/vertx/TestCoreVerticle.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import io.vertx.junit5.VertxExtension;
2727
import io.vertx.junit5.VertxTestContext;
2828

29-
import static com.uid2.core.Const.OPERATOR_CONFIG_PATH;
3029
import static org.junit.jupiter.api.Assertions.*;
3130

3231
import org.junit.jupiter.api.BeforeEach;
@@ -123,20 +122,20 @@ void deployVerticle(TestInfo info, Vertx vertx, VertxTestContext testContext) th
123122
}
124123
});
125124

126-
operatorConfig = Files.readString(Paths.get(OPERATOR_CONFIG_PATH)).trim();
125+
operatorConfig = Files.readString(Paths.get(com.uid2.core.Const.OPERATOR_CONFIG_PATH)).trim();
127126

128127
when(fileSystem.readFile(anyString(), any())).thenAnswer(invocation -> {
129128
String path = invocation.getArgument(0);
130129
Handler<AsyncResult<Buffer>> handler = invocation.getArgument(1);
131-
if (Objects.equals(path, OPERATOR_CONFIG_PATH)) {
130+
if (Objects.equals(path, com.uid2.core.Const.OPERATOR_CONFIG_PATH)) {
132131
handler.handle(Future.succeededFuture(Buffer.buffer(operatorConfig)));
133132
} else {
134133
handler.handle(Future.failedFuture(new RuntimeException("Failed to read file: " + path)));
135134
}
136135
return null;
137136
});
138137

139-
CoreVerticle verticle = new CoreVerticle(cloudStorage, authProvider, attestationService, attestationTokenService, enclaveIdentifierProvider, operatorJWTTokenProvider, jwtService, cloudEncryptionKeyProvider, fileSystem, OPERATOR_CONFIG_PATH);
138+
CoreVerticle verticle = new CoreVerticle(cloudStorage, authProvider, attestationService, attestationTokenService, enclaveIdentifierProvider, operatorJWTTokenProvider, jwtService, cloudEncryptionKeyProvider, fileSystem);
140139
vertx.deployVerticle(verticle, testContext.succeeding(id -> testContext.completeNow()));
141140

142141
}

src/test/java/com/uid2/core/vertx/TestServiceLinkMetadataPath.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import java.net.URL;
3636
import java.util.HashSet;
3737

38-
import static com.uid2.core.Const.OPERATOR_CONFIG_PATH;
3938
import static com.uid2.shared.Utils.readToEndAsString;
4039
import static org.junit.jupiter.api.Assertions.assertEquals;
4140
import static org.mockito.ArgumentMatchers.any;
@@ -75,7 +74,7 @@ void deployVerticle(Vertx vertx, VertxTestContext testContext) throws Throwable
7574
fileSystem = vertx.fileSystem();
7675
SecretStore.Global.load(((JsonObject) Json.decodeValue(openFile("/com.uid2.core/testGlobalMetadata/test-secrets.json"))));
7776
MockitoAnnotations.initMocks(this);
78-
CoreVerticle verticle = new CoreVerticle(cloudStorage, authProvider, attestationService, attestationTokenService, enclaveIdentifierProvider, operatorJWTTokenProvider, jwtService, fileSystem, OPERATOR_CONFIG_PATH);
77+
CoreVerticle verticle = new CoreVerticle(cloudStorage, authProvider, attestationService, attestationTokenService, enclaveIdentifierProvider, operatorJWTTokenProvider, jwtService, fileSystem);
7978
vertx.deployVerticle(verticle, testContext.succeeding(id -> testContext.completeNow()));
8079
}
8180

src/test/java/com/uid2/core/vertx/TestServiceMetadataPath.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import java.net.URL;
3636
import java.util.HashSet;
3737

38-
import static com.uid2.core.Const.OPERATOR_CONFIG_PATH;
3938
import static com.uid2.shared.Utils.readToEndAsString;
4039
import static org.junit.jupiter.api.Assertions.assertEquals;
4140
import static org.mockito.ArgumentMatchers.any;
@@ -75,7 +74,7 @@ void deployVerticle(Vertx vertx, VertxTestContext testContext) throws Throwable
7574
fileSystem = vertx.fileSystem();
7675
SecretStore.Global.load(((JsonObject) Json.decodeValue(openFile("/com.uid2.core/testGlobalMetadata/test-secrets.json"))));
7776
MockitoAnnotations.initMocks(this);
78-
CoreVerticle verticle = new CoreVerticle(cloudStorage, authProvider, attestationService, attestationTokenService, enclaveIdentifierProvider, operatorJWTTokenProvider, jwtService, fileSystem, OPERATOR_CONFIG_PATH);
77+
CoreVerticle verticle = new CoreVerticle(cloudStorage, authProvider, attestationService, attestationTokenService, enclaveIdentifierProvider, operatorJWTTokenProvider, jwtService, fileSystem);
7978
vertx.deployVerticle(verticle, testContext.succeeding(id -> testContext.completeNow()));
8079
}
8180

src/test/java/com/uid2/core/vertx/TestSiteSpecificMetadataPath.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import java.net.URL;
3232
import java.util.HashSet;
3333

34-
import static com.uid2.core.Const.OPERATOR_CONFIG_PATH;
3534
import static com.uid2.shared.Utils.readToEndAsString;
3635
import static org.junit.jupiter.api.Assertions.*;
3736
import static org.mockito.Mockito.*;
@@ -74,7 +73,7 @@ void deployVerticle(Vertx vertx, VertxTestContext testContext) throws Throwable
7473
SecretStore.Global.load(((JsonObject) Json.decodeValue(openFile("/com.uid2.core/testSiteSpecificMetadata/test-secrets.json"))));
7574
ConfigStore.Global.load(((JsonObject) Json.decodeValue(openFile("/com.uid2.core/testSiteSpecificMetadata/test-configs-provide-private-site-data.json"))));
7675
MockitoAnnotations.initMocks(this);
77-
CoreVerticle verticle = new CoreVerticle(cloudStorage, authProvider, attestationService, attestationTokenService, enclaveIdentifierProvider, operatorJWTTokenProvider, jwtService, fileSystem, OPERATOR_CONFIG_PATH);
76+
CoreVerticle verticle = new CoreVerticle(cloudStorage, authProvider, attestationService, attestationTokenService, enclaveIdentifierProvider, operatorJWTTokenProvider, jwtService, fileSystem);
7877
vertx.deployVerticle(verticle, testContext.succeeding(id -> testContext.completeNow()));
7978
}
8079

src/test/java/com/uid2/core/vertx/TestSiteSpecificMetadataPathDisabled.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import java.net.URL;
3434
import java.util.HashSet;
3535

36-
import static com.uid2.core.Const.OPERATOR_CONFIG_PATH;
3736
import static com.uid2.shared.Utils.readToEndAsString;
3837
import static org.junit.jupiter.api.Assertions.assertEquals;
3938
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -76,7 +75,7 @@ void deployVerticle(Vertx vertx, VertxTestContext testContext) throws Throwable
7675
SecretStore.Global.load(((JsonObject) Json.decodeValue(openFile("/com.uid2.core/testSiteSpecificMetadata/test-secrets.json"))));
7776
ConfigStore.Global.load(((JsonObject) Json.decodeValue(openFile("/com.uid2.core/testSiteSpecificMetadata/test-configs-stop-providing-private-site-data.json"))));
7877
MockitoAnnotations.initMocks(this);
79-
CoreVerticle verticle = new CoreVerticle(cloudStorage, authProvider, attestationService, attestationTokenService, enclaveIdentifierProvider, operatorJWTTokenProvider, jwtService, fileSystem, OPERATOR_CONFIG_PATH);
78+
CoreVerticle verticle = new CoreVerticle(cloudStorage, authProvider, attestationService, attestationTokenService, enclaveIdentifierProvider, operatorJWTTokenProvider, jwtService, fileSystem);
8079
vertx.deployVerticle(verticle, testContext.succeeding(id -> testContext.completeNow()));
8180
}
8281

src/test/java/com/uid2/core/vertx/TestSitesMetadataPath.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import java.net.URL;
3636
import java.util.HashSet;
3737

38-
import static com.uid2.core.Const.OPERATOR_CONFIG_PATH;
3938
import static com.uid2.core.util.MetadataHelper.readToEndAsString;
4039
import static org.junit.jupiter.api.Assertions.assertEquals;
4140
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -79,7 +78,7 @@ void deployVerticle(Vertx vertx, VertxTestContext testContext) throws Throwable
7978
fileSystem = vertx.fileSystem();
8079
SecretStore.Global.load(((JsonObject) Json.decodeValue(openFile("/com.uid2.core/testGlobalMetadata/test-secrets.json"))));
8180
MockitoAnnotations.initMocks(this);
82-
CoreVerticle verticle = new CoreVerticle(cloudStorage, authProvider, attestationService, attestationTokenService, enclaveIdentifierProvider, operatorJWTTokenProvider, jwtService, fileSystem, OPERATOR_CONFIG_PATH);
81+
CoreVerticle verticle = new CoreVerticle(cloudStorage, authProvider, attestationService, attestationTokenService, enclaveIdentifierProvider, operatorJWTTokenProvider, jwtService, fileSystem);
8382
vertx.deployVerticle(verticle, testContext.succeeding(id -> testContext.completeNow()));
8483
}
8584

0 commit comments

Comments
 (0)