2121import com .uid2 .shared .secure .*;
2222import com .uid2 .shared .vertx .RequestCapturingHandler ;
2323import com .uid2 .shared .vertx .VertxUtils ;
24+ import io .vertx .config .ConfigRetriever ;
25+ import io .vertx .config .ConfigRetrieverOptions ;
26+ import io .vertx .config .ConfigStoreOptions ;
2427import io .vertx .core .AbstractVerticle ;
2528import io .vertx .core .Promise ;
2629import io .vertx .core .http .HttpHeaders ;
@@ -192,6 +195,7 @@ private Router createRoutesSetup() {
192195 router .get (Endpoints .OPERATORS_REFRESH .toString ()).handler (auth .handle (attestationMiddleware .handle (this ::handleOperatorRefresh ), Role .OPTOUT_SERVICE ));
193196 router .get (Endpoints .PARTNERS_REFRESH .toString ()).handler (auth .handle (attestationMiddleware .handle (this ::handlePartnerRefresh ), Role .OPTOUT_SERVICE ));
194197 router .get (Endpoints .OPS_HEALTHCHECK .toString ()).handler (this ::handleHealthCheck );
198+ router .get (Endpoints .CONFIG .toString ()).handler (this ::handleGetConfig );
195199
196200 if (Optional .ofNullable (ConfigStore .Global .getBoolean ("enable_test_endpoints" )).orElse (false )) {
197201 router .route (Endpoints .ATTEST_GET_TOKEN .toString ()).handler (auth .handle (this ::handleTestGetAttestationToken , Role .OPERATOR ));
@@ -200,6 +204,31 @@ private Router createRoutesSetup() {
200204 return router ;
201205 }
202206
207+ private void handleGetConfig (RoutingContext rc ) {
208+ String dummyConfigPath = "conf/dummy-config.json" ;
209+
210+ ConfigStoreOptions dummyFileStore = new ConfigStoreOptions ()
211+ .setType ("file" )
212+ .setConfig (new JsonObject ().put ("path" , dummyConfigPath ));
213+
214+ ConfigRetrieverOptions retrieverOptions = new ConfigRetrieverOptions ().addStore (dummyFileStore );
215+
216+ ConfigRetriever retriever = ConfigRetriever .create (vertx , retrieverOptions );
217+
218+ retriever .getConfig ().onComplete (ar -> {
219+ if (ar .succeeded ()) {
220+ rc .response ()
221+ .putHeader ("content-type" , "application/json" )
222+ .end (ar .result ().encodePrettily ());
223+ } else {
224+ rc .response ()
225+ .setStatusCode (500 )
226+ .end ("Failed to retrieve configuration" );
227+ }
228+ });
229+ }
230+
231+
203232 private void handleHealthCheck (RoutingContext rc ) {
204233 if (HealthManager .instance .isHealthy ()) {
205234 rc .response ().end ("OK" );
0 commit comments