|
32 | 32 | import java.nio.file.Paths; |
33 | 33 | import java.nio.file.StandardOpenOption; |
34 | 34 | import java.util.ArrayList; |
| 35 | +import java.util.Arrays; |
| 36 | +import java.util.Collections; |
35 | 37 | import java.util.Comparator; |
36 | 38 | import java.util.List; |
37 | 39 | import java.util.Optional; |
@@ -59,14 +61,59 @@ public class ConfigurationsTest { |
59 | 61 | public static String UPDATE_CMD = |
60 | 62 | "UPDATE=1 ./mvnw test -pl amoro-ams -am -Dtest=ConfigurationsTest"; |
61 | 63 |
|
| 64 | + private static final List<String> RBAC_EXAMPLE = |
| 65 | + Arrays.asList( |
| 66 | + "## RBAC Example", |
| 67 | + "", |
| 68 | + "Enable RBAC only when you need role separation for dashboard users." |
| 69 | + + " When `http-server.authorization.enabled`", |
| 70 | + "is `false`, all authenticated dashboard users keep admin behavior for compatibility.", |
| 71 | + "", |
| 72 | + "```yaml", |
| 73 | + "ams:", |
| 74 | + " http-server:", |
| 75 | + " authorization:", |
| 76 | + " enabled: true", |
| 77 | + " default-role: READ_ONLY", |
| 78 | + " admin-users:", |
| 79 | + " - alice", |
| 80 | + " - bob", |
| 81 | + " users:", |
| 82 | + " - username: admin", |
| 83 | + " password: admin", |
| 84 | + " role: ADMIN", |
| 85 | + " - username: viewer", |
| 86 | + " password: viewer123", |
| 87 | + " role: READ_ONLY", |
| 88 | + "```", |
| 89 | + "", |
| 90 | + "```yaml", |
| 91 | + "ams:", |
| 92 | + " http-server:", |
| 93 | + " login-auth-provider: org.apache.amoro.server.authentication.LdapPasswdAuthenticationProvider", |
| 94 | + " login-auth-ldap-url: \"ldap://ldap.example.com:389\"", |
| 95 | + " login-auth-ldap-user-pattern: \"uid={0},ou=people,dc=example,dc=com\"", |
| 96 | + " authorization:", |
| 97 | + " enabled: true", |
| 98 | + " default-role: READ_ONLY", |
| 99 | + " ldap-role-mapping:", |
| 100 | + " enabled: true", |
| 101 | + " admin-group-dn: \"cn=amoro-admins,ou=groups,dc=example,dc=com\"", |
| 102 | + " group-member-attribute: \"member\"", |
| 103 | + " user-dn-pattern: \"uid={0},ou=people,dc=example,dc=com\"", |
| 104 | + " bind-dn: \"cn=service-account,dc=example,dc=com\"", |
| 105 | + " bind-password: \"service-password\"", |
| 106 | + "```"); |
| 107 | + |
62 | 108 | @Test |
63 | 109 | public void testAmoroManagementConfDocumentation() throws Exception { |
64 | 110 | List<AmoroConfInfo> confInfoList = new ArrayList<>(); |
65 | 111 | confInfoList.add( |
66 | 112 | new AmoroConfInfo( |
67 | 113 | AmoroManagementConf.class, |
68 | 114 | "Amoro Management Service Configuration", |
69 | | - "The configuration options for Amoro Management Service (AMS).")); |
| 115 | + "The configuration options for Amoro Management Service (AMS).", |
| 116 | + RBAC_EXAMPLE)); |
70 | 117 | confInfoList.add( |
71 | 118 | new AmoroConfInfo( |
72 | 119 | ConfigShadeUtils.class, |
@@ -147,6 +194,12 @@ protected void generateConfigurationMarkdown( |
147 | 194 |
|
148 | 195 | // Add some space between different configuration sections |
149 | 196 | output.add(""); |
| 197 | + |
| 198 | + // Add appendix content if present |
| 199 | + if (confInfo.appendix != null && !confInfo.appendix.isEmpty()) { |
| 200 | + output.addAll(confInfo.appendix); |
| 201 | + } |
| 202 | + |
150 | 203 | output.add(""); |
151 | 204 | } |
152 | 205 |
|
@@ -299,11 +352,21 @@ public static class AmoroConfInfo { |
299 | 352 | Class<?> confClass; |
300 | 353 | String title; |
301 | 354 | String description; |
| 355 | + List<String> appendix; |
302 | 356 |
|
303 | 357 | public AmoroConfInfo(Class<?> confClass, String title, String description) { |
304 | 358 | this.confClass = confClass; |
305 | 359 | this.title = title; |
306 | 360 | this.description = description; |
| 361 | + this.appendix = Collections.emptyList(); |
| 362 | + } |
| 363 | + |
| 364 | + public AmoroConfInfo( |
| 365 | + Class<?> confClass, String title, String description, List<String> appendix) { |
| 366 | + this.confClass = confClass; |
| 367 | + this.title = title; |
| 368 | + this.description = description; |
| 369 | + this.appendix = appendix; |
307 | 370 | } |
308 | 371 | } |
309 | 372 | } |
0 commit comments