99import com .uid2 .shared .auth .Role ;
1010import io .vertx .core .http .HttpHeaders ;
1111import io .vertx .core .json .JsonArray ;
12+ import io .vertx .core .json .JsonObject ;
1213import io .vertx .ext .web .Router ;
1314import io .vertx .ext .web .RoutingContext ;
1415
1516import java .util .Collections ;
1617import java .util .List ;
1718
1819import static com .uid2 .admin .vertx .Endpoints .API_PARTNER_CONFIG_LIST ;
20+ import static com .uid2 .admin .vertx .Endpoints .API_PARTNER_CONFIG_GET ;
1921import static com .uid2 .admin .vertx .Endpoints .API_PARTNER_CONFIG_UPDATE ;
2022
2123public class PartnerConfigService implements IService {
@@ -38,6 +40,8 @@ public PartnerConfigService(AdminAuthMiddleware auth,
3840 public void setupRoutes (Router router ) {
3941 router .get (API_PARTNER_CONFIG_LIST .toString ()).handler (
4042 auth .handle (this ::handlePartnerConfigList , Role .MAINTAINER ));
43+ router .get (API_PARTNER_CONFIG_GET .toString ()).handler (
44+ auth .handle (this ::handlePartnerConfigGet , Role .MAINTAINER ));
4145 router .post (API_PARTNER_CONFIG_UPDATE .toString ()).blockingHandler (auth .handle ((ctx ) -> {
4246 synchronized (writeLock ) {
4347 this .handlePartnerConfigUpdate (ctx );
@@ -56,6 +60,34 @@ private void handlePartnerConfigList(RoutingContext rc) {
5660 }
5761 }
5862
63+ private void handlePartnerConfigGet (RoutingContext rc ) {
64+ try {
65+ final String partnerName = rc .pathParam ("partner_name" );
66+ if (partnerName == null ) {
67+ ResponseUtil .error (rc , 400 , "Partner name is required" );
68+ return ;
69+ }
70+
71+ String config = this .partnerConfigProvider .getConfig ();
72+ JsonObject allPartnerConfigs = new JsonObject (config );
73+
74+ // Look for the specific partner
75+ if (allPartnerConfigs .containsKey (partnerName )) {
76+ JsonObject partnerConfig = allPartnerConfigs .getJsonObject (partnerName );
77+
78+ rc .response ()
79+ .putHeader (HttpHeaders .CONTENT_TYPE , "application/json" )
80+ .end (partnerConfig .encode ());
81+
82+ } else {
83+ // Partner not found
84+ ResponseUtil .error (rc , 404 , "Partner '" + partnerName + "' not found" );
85+ }
86+ } catch (Exception e ) {
87+ rc .fail (500 , e );
88+ }
89+ }
90+
5991 private void handlePartnerConfigUpdate (RoutingContext rc ) {
6092 try {
6193 // refresh manually
0 commit comments