pzampino commented on a change in pull request #430:
URL: https://github.com/apache/knox/pull/430#discussion_r608927174



##########
File path: 
gateway-server/src/main/java/org/apache/knox/gateway/config/impl/GatewayConfigImpl.java
##########
@@ -1209,4 +1211,23 @@ public long getKeystoreCacheEntryTimeToLiveInMinutes() {
   public boolean isGatewayServerIncomingXForwardedSupportEnabled() {
     return getBoolean(KNOX_INCOMING_XFORWARDED_ENABLED, true);
   }
+
+  @Override
+  public Map<String, Collection<String>> getHomePageProfiles() {
+    final Map<String, Collection<String>> profiles = 
getPreConfiguredProfiles(); // pre-configured profiles might be overwritten
+    this.forEach(config -> {
+      if (config.getKey().startsWith(KNOX_HOMEPAGE_PROFILE_PREFIX)) {
+        
profiles.put(config.getKey().substring(KNOX_HOMEPAGE_PROFILE_PREFIX.length()), 
getTrimmedStringCollection(config.getKey()));
+      }
+    });
+    return profiles;
+  }
+
+  private Map<String, Collection<String>> getPreConfiguredProfiles() {
+    final Map<String, Collection<String>> profiles = new HashMap<>();
+    profiles.put("full", Arrays.asList("gpi_version", "gpi_cert", 
"gpi_admin_ui", "gpi_admin_api", "gpi_md_api", "gpi_tokens"));

Review comment:
       Why not reference the constants in the Profile class?
   
   I might go so far as to define the arrays as constants too.
   
   ```
   static final String[] PROFILE_FULL = {Profile.GPI_VERSION, Profile.GPI_CERT, 
Profile.GPI_ADMIN_UI, Profile.GPI_ADMIN_API, Profile.GPI_METADATA_API, 
Profile.GPI_TOKENS};
   
   static final String[] PROFILE_THIN = {Profile.GPI_VERSION, Profile.GPI_CERT};
   
   static final String[] PROFILE_TOKEN = {Profile.GPI_VERSION, 
Profile.GPI_TOKENS};
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to