Skip to content

Commit 7b7296a

Browse files
authored
Standardize configuration properties (#4452)
* Standardize configuration properties * Refactor application properties files * Make integration tests use the new application properties * Make integration tests use the vertx client internally * Make integration tests publish multi arch images * Fix go sdk test * Rename registry properties to apicurio properties * Fix ui configuration page * Rename missing properties * Fix download ttl property name * Align configuration properties * Fix sql storage kind in integration tests * Fix remaining properties issues
1 parent 7f8b90e commit 7b7296a

File tree

108 files changed

+786
-868
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+786
-868
lines changed

.github/workflows/integration-tests.yaml

+18-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,23 @@ jobs:
3838
distribution: 'temurin'
3939
cache: 'maven'
4040

41+
# Open-Source Machine emulator that allows you to emulate multiple CPU architectures on your machine
42+
- name: Set up QEMU
43+
uses: docker/setup-qemu-action@v1
44+
45+
# Docker CLI plugin for extended build capabilities with BuildKit
46+
- name: Set up Docker Buildx
47+
id: buildx
48+
uses: docker/setup-buildx-action@v1
49+
50+
- name: Inspect builder
51+
run: |
52+
echo "Name: ${{ steps.buildx.outputs.name }}"
53+
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
54+
echo "Status: ${{ steps.buildx.outputs.status }}"
55+
echo "Flags: ${{ steps.buildx.outputs.flags }}"
56+
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
57+
4158
- name: Get maven wrapper
4259
run: mvn -N io.takari:maven:wrapper -Dmaven=3.8.2
4360

@@ -46,7 +63,7 @@ jobs:
4663

4764
- name: Build and Push Application image
4865
run: |
49-
docker build --push -f ./distro/docker/target/docker/Dockerfile.jvm -t ttl.sh/${{ github.sha }}/apicurio/apicurio-registry:1d ./distro/docker/target/docker
66+
docker buildx build --push -f ./distro/docker/target/docker/Dockerfile.jvm -t ttl.sh/${{ github.sha }}/apicurio/apicurio-registry:1d --platform linux/amd64,linux/arm64,linux/s390x,linux/ppc64le ./distro/docker/target/docker
5067
5168
prepare-ui-tests:
5269
name: Prepare for UI Integration Tests

README.md

+28-28
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ Starting with Apicurio Registry 3.0, we now produce a single artifact suitable f
2222

2323
Which storage variant will be used is determined by the following configuration:
2424

25-
|Option|Command argument|Env. variable|
26-
|---|---|---|
27-
|Registry Storage Variant|`-Dregistry.storage.kind`|`REGISTRY_STORAGE_KIND`|
25+
|Option|Command argument| Env. variable |
26+
|---|---|-------------------------|
27+
|Registry Storage Variant|`-Dapicurio.storage.kind`| `APICURIO_STORAGE_KIND` |
2828

2929
For this property, there are three possible values:
3030
- *sql* - for the SQL storage variant.
@@ -79,12 +79,12 @@ The following parameters are available for executable files:
7979
- By default, the application expects an H2 server running at `jdbc:h2:tcp://localhost:9123/mem:registry`.
8080
- For configuring the database kind and the datasource values, the following configuration options are available:
8181

82-
| Option |Command argument| Env. variable |
83-
|---------------------------|---|--------------------------------|
84-
| Registry SQL storage kind |`-Dregistry.storage.db-kind`| `REGISTRY_STORAGE_DB_KIND` |
85-
| Data Source URL |`-Dregistry.datasource.url`| `REGISTRY_DATASOURCE_URL` |
86-
| DS Username |`-Dregistry.datasource.username`| `REGISTRY_DATASOURCE_USERNAME` |
87-
| DS Password |`-Dregistry.datasource.password`| `REGISTRY_DATASOURCE_PASSWORD` |
82+
| Option | Command argument | Env. variable |
83+
|---------------------------|---------------------------------|--------------------------------|
84+
| Registry SQL storage kind | `-Dapicurio.storage.sql.kind` | `APICURIO_STORAGE_SQL_KIND` |
85+
| Data Source URL | `-Dapicurio.datasource.url` | `APICURIO_DATASOURCE_URL` |
86+
| DS Username | `-Dapicurio.datasource.username` | `APICURIO_DATASOURCE_USERNAME` |
87+
| DS Password | `-Dapicurio.datasource.password` | `APICURIO_DATASOURCE_PASSWORD` |
8888

8989
To see additional options, visit:
9090
- [Data Source config](https://quarkus.io/guides/datasource)
@@ -94,9 +94,9 @@ To see additional options, visit:
9494
`./mvnw clean install -Pprod -DskipTests` builds the application artifact.
9595
The newly built runner can be found in `/app/target`
9696
```
97-
java Dregistry.storage.kind=kafkasql -jar apicurio-registry-app-<version>-SNAPSHOT-runner.jar
97+
java Dapicurio.storage.kind=kafkasql -jar apicurio-registry-app-<version>-SNAPSHOT-runner.jar
9898
```
99-
For using Kafka as the persistent storage for the server information the only required configuration is to set the property *registry.storage.kind*.
99+
For using Kafka as the persistent storage for the server information the only required configuration is to set the property *apicurio.storage.kind*.
100100

101101
Should result in Quarkus and the registry starting up, with the ui and APIs available on localhost port 8080.
102102
By default, this will look for a kafka instance on `localhost:9092`, see [kafka-quickstart](https://kafka.apache.org/quickstart).
@@ -106,14 +106,14 @@ with the necessary details to connect to a kafka instance using a PKCS12 certifi
106106
scram-sha-512 credentials for user authorisation.
107107
```
108108
java \
109-
-Dregistry.storage.kind=kafkasql \
110-
-Dregistry.kafka.common.bootstrap.servers=<kafka_bootstrap_server_address> \
111-
-Dregistry.kafka.common.ssl.truststore.location=<truststore_file_location>\
112-
-Dregistry.kafka.common.ssl.truststore.password=<truststore_file_password> \
113-
-Dregistry.kafka.common.ssl.truststore.type=PKCS12 \
114-
-Dregistry.kafka.common.security.protocol=SASL_SSL \
115-
-Dregistry.kafka.common.sasl.mechanism=SCRAM-SHA-512 \
116-
-Dregistry.kafka.common.sasl.jaas.config='org.apache.kafka.common.security.scram.ScramLoginModule required username="<username>" password="<password>";' \
109+
-Dapicurio.storage.kind=kafkasql \
110+
-Dapicurio.kafka.common.bootstrap.servers=<kafka_bootstrap_server_address> \
111+
-Dapicurio.kafka.common.ssl.truststore.location=<truststore_file_location>\
112+
-Dapicurio.kafka.common.ssl.truststore.password=<truststore_file_password> \
113+
-Dapicurio.kafka.common.ssl.truststore.type=PKCS12 \
114+
-Dapicurio.kafka.common.security.protocol=SASL_SSL \
115+
-Dapicurio.kafka.common.sasl.mechanism=SCRAM-SHA-512 \
116+
-Dapicurio.kafka.common.sasl.jaas.config='org.apache.kafka.common.security.scram.ScramLoginModule required username="<username>" password="<password>";' \
117117
-jar app/target/apicurio-registry-app-3.0.0-SNAPSHOT-runner.jar
118118
```
119119
This will start up the registry with the persistence managed by the external kafka cluster.
@@ -176,11 +176,11 @@ services:
176176
ports:
177177
- 8080:8080
178178
environment:
179-
REGISTRY_STORAGE_KIND: 'sql'
180-
REGISTRY_STORAGE_DB_KIND: 'postgresql'
181-
REGISTRY_DATASOURCE_URL: 'jdbc:postgresql://postgres/apicurio-registry'
182-
REGISTRY_DATASOURCE_USERNAME: apicurio-registry
183-
REGISTRY_DATASOURCE_PASSWORD: password
179+
APICURIO_STORAGE_KIND: 'sql'
180+
APICURIO_STORAGE_DB_KIND: 'postgresql'
181+
APICURIO_DATASOURCE_URL: 'jdbc:postgresql://postgres/apicurio-registry'
182+
APICURIO_DATASOURCE_USERNAME: apicurio-registry
183+
APICURIO_DATASOURCE_PASSWORD: password
184184
```
185185
- Run `docker-compose -f test.yml up`
186186

@@ -205,10 +205,10 @@ In order no enable this integration, you will need to set the following environm
205205

206206
|Option|Env. variable|
207207
|---|---|
208-
|`REGISTRY_AUTH_TYPE`|Set to `oidc` (default is `none`)|
209-
|`REGISTRY_AUTH_URL`|OIDC auth URL|
210-
|`REGISTRY_AUTH_REDIRECT_URL`|OIDC redirect URL|
211-
|`REGISTRY_AUTH_CLIENT_ID`|The client for the UI|
208+
|`APICURIO_AUTH_TYPE`|Set to `oidc` (default is `none`)|
209+
|`APICURIO_AUTH_URL`|OIDC auth URL|
210+
|`APICURIO_AUTH_REDIRECT_URL`|OIDC redirect URL|
211+
|`APICURIO_AUTH_CLIENT_ID`|The client for the UI|
212212

213213
Note that you will need to have everything configured in your OIDC provider, before starting the application
214214
(the realm and the two clients).

app/pom.xml

+8-2
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,14 @@
113113
<groupId>io.quarkus</groupId>
114114
<artifactId>quarkus-oidc</artifactId>
115115
</dependency>
116+
<dependency>
117+
<groupId>io.quarkus</groupId>
118+
<artifactId>quarkus-elytron-security-properties-file</artifactId>
119+
</dependency>
120+
<dependency>
121+
<groupId>io.quarkus</groupId>
122+
<artifactId>quarkus-smallrye-jwt</artifactId>
123+
</dependency>
116124
<dependency>
117125
<groupId>io.quarkus</groupId>
118126
<artifactId>quarkus-scheduler</artifactId>
@@ -408,7 +416,6 @@
408416
<inputs>
409417
<param>${project.build.outputDirectory}/application.properties</param>
410418
<param>${project.build.outputDirectory}/application-prod.properties</param>
411-
<param>${project.build.outputDirectory}/application-dev.properties</param>
412419
<param>${project.build.outputDirectory}/application-test.properties</param>
413420
</inputs>
414421
<deleteInputs>false</deleteInputs>
@@ -425,7 +432,6 @@
425432
<inputs>
426433
<param>${project.build.outputDirectory}/application.properties</param>
427434
<param>${project.build.outputDirectory}/application-prod.properties</param>
428-
<param>${project.build.outputDirectory}/application-dev.properties</param>
429435
<param>${project.build.outputDirectory}/application-test.properties</param>
430436
</inputs>
431437
<deleteInputs>true</deleteInputs>

app/src/main/java/io/apicurio/registry/ImportLifecycleBean.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class ImportLifecycleBean {
3333
@Current
3434
RegistryStorage storage;
3535

36-
@ConfigProperty(name = "registry.import.url")
36+
@ConfigProperty(name = "apicurio.import.url")
3737
@Info(category = "import", description = "The import URL", availableSince = "2.1.0.Final")
3838
Optional<URL> registryImportUrlProp;
3939

app/src/main/java/io/apicurio/registry/auth/AuthConfig.java

+23-23
Original file line numberDiff line numberDiff line change
@@ -17,80 +17,80 @@ public class AuthConfig {
1717
@Inject
1818
Logger log;
1919

20-
@ConfigProperty(name = "registry.auth.enabled", defaultValue = "false")
20+
@ConfigProperty(name = "quarkus.oidc.tenant-enabled", defaultValue = "false")
2121
boolean authenticationEnabled;
2222

23-
@ConfigProperty(name = "registry.auth.role-based-authorization", defaultValue = "false")
23+
@ConfigProperty(name = "apicurio.auth.role-based-authorization", defaultValue = "false")
2424
@Info(category = "auth", description = "Enable role based authorization", availableSince = "2.1.0.Final")
2525
boolean roleBasedAuthorizationEnabled;
2626

27-
@Dynamic(label = "Artifact owner-only authorization", description = "When selected, Service Registry allows only the artifact owner (creator) to modify an artifact.", requires = "registry.auth.enabled=true")
28-
@ConfigProperty(name = "registry.auth.owner-only-authorization", defaultValue = "false")
27+
@Dynamic(label = "Artifact owner-only authorization", description = "When selected, Service Registry allows only the artifact owner (creator) to modify an artifact.", requires = "apicurio.auth.enabled=true")
28+
@ConfigProperty(name = "apicurio.auth.owner-only-authorization", defaultValue = "false")
2929
@Info(category = "auth", description = "Artifact owner-only authorization", availableSince = "2.0.0.Final")
3030
Supplier<Boolean> ownerOnlyAuthorizationEnabled;
3131

3232
@Dynamic(label = "Artifact group owner-only authorization", description = "When selected, Service Registry allows only the artifact group owner (creator) to modify an artifact group.", requires = {
33-
"registry.auth.enabled=true",
34-
"registry.auth.owner-only-authorization=true"
33+
"apicurio.auth.enabled=true",
34+
"apicurio.auth.owner-only-authorization=true"
3535
})
36-
@ConfigProperty(name = "registry.auth.owner-only-authorization.limit-group-access", defaultValue = "false")
36+
@ConfigProperty(name = "apicurio.auth.owner-only-authorization.limit-group-access", defaultValue = "false")
3737
@Info(category = "auth", description = "Artifact group owner-only authorization", availableSince = "2.1.0.Final")
3838
Supplier<Boolean> ownerOnlyAuthorizationLimitGroupAccess;
3939

40-
@Dynamic(label = "Anonymous read access", description = "When selected, requests from anonymous users (requests without any credentials) are granted read-only access.", requires = "registry.auth.enabled=true")
41-
@ConfigProperty(name = "registry.auth.anonymous-read-access.enabled", defaultValue = "false")
40+
@Dynamic(label = "Anonymous read access", description = "When selected, requests from anonymous users (requests without any credentials) are granted read-only access.", requires = "apicurio.auth.enabled=true")
41+
@ConfigProperty(name = "apicurio.auth.anonymous-read-access.enabled", defaultValue = "false")
4242
@Info(category = "auth", description = "Anonymous read access", availableSince = "2.1.0.Final")
4343
Supplier<Boolean> anonymousReadAccessEnabled;
4444

4545
@Dynamic(label = "Authenticated read access", description = "When selected, requests from any authenticated user are granted at least read-only access.", requires = {
46-
"registry.auth.enabled=true",
47-
"registry.auth.role-based-authorization=true"
46+
"apicurio.auth.enabled=true",
47+
"apicurio.auth.role-based-authorization=true"
4848
})
49-
@ConfigProperty(name = "registry.auth.authenticated-read-access.enabled", defaultValue = "false")
49+
@ConfigProperty(name = "apicurio.auth.authenticated-read-access.enabled", defaultValue = "false")
5050
@Info(category = "auth", description = "Authenticated read access", availableSince = "2.1.4.Final")
5151
Supplier<Boolean> authenticatedReadAccessEnabled;
5252

53-
@ConfigProperty(name = "registry.auth.roles.readonly", defaultValue = "sr-readonly")
53+
@ConfigProperty(name = "apicurio.auth.roles.readonly", defaultValue = "sr-readonly")
5454
@Info(category = "auth", description = "Auth roles readonly", availableSince = "2.1.0.Final")
5555
String readOnlyRole;
5656

57-
@ConfigProperty(name = "registry.auth.roles.developer", defaultValue = "sr-developer")
57+
@ConfigProperty(name = "apicurio.auth.roles.developer", defaultValue = "sr-developer")
5858
@Info(category = "auth", description = "Auth roles developer", availableSince = "2.1.0.Final")
5959
String developerRole;
6060

61-
@ConfigProperty(name = "registry.auth.roles.admin", defaultValue = "sr-admin")
61+
@ConfigProperty(name = "apicurio.auth.roles.admin", defaultValue = "sr-admin")
6262
@Info(category = "auth", description = "Auth roles admin", availableSince = "2.0.0.Final")
6363
String adminRole;
6464

65-
@ConfigProperty(name = "registry.auth.role-source", defaultValue = "token")
65+
@ConfigProperty(name = "apicurio.auth.role-source", defaultValue = "token")
6666
@Info(category = "auth", description = "Auth roles source", availableSince = "2.1.0.Final")
6767
String roleSource;
6868

69-
@ConfigProperty(name = "registry.auth.admin-override.enabled", defaultValue = "false")
69+
@ConfigProperty(name = "apicurio.auth.admin-override.enabled", defaultValue = "false")
7070
@Info(category = "auth", description = "Auth admin override enabled", availableSince = "2.1.0.Final")
7171
boolean adminOverrideEnabled;
7272

73-
@ConfigProperty(name = "registry.auth.admin-override.from", defaultValue = "token")
73+
@ConfigProperty(name = "apicurio.auth.admin-override.from", defaultValue = "token")
7474
@Info(category = "auth", description = "Auth admin override from", availableSince = "2.1.0.Final")
7575
String adminOverrideFrom;
7676

77-
@ConfigProperty(name = "registry.auth.admin-override.type", defaultValue = "role")
77+
@ConfigProperty(name = "apicurio.auth.admin-override.type", defaultValue = "role")
7878
@Info(category = "auth", description = "Auth admin override type", availableSince = "2.1.0.Final")
7979
String adminOverrideType;
8080

81-
@ConfigProperty(name = "registry.auth.admin-override.role", defaultValue = "sr-admin")
81+
@ConfigProperty(name = "apicurio.auth.admin-override.role", defaultValue = "sr-admin")
8282
@Info(category = "auth", description = "Auth admin override role", availableSince = "2.1.0.Final")
8383
String adminOverrideRole;
8484

85-
@ConfigProperty(name = "registry.auth.admin-override.claim", defaultValue = "org-admin")
85+
@ConfigProperty(name = "apicurio.auth.admin-override.claim", defaultValue = "org-admin")
8686
@Info(category = "auth", description = "Auth admin override claim", availableSince = "2.1.0.Final")
8787
String adminOverrideClaim;
8888

89-
@ConfigProperty(name = "registry.auth.admin-override.claim-value", defaultValue = "true")
89+
@ConfigProperty(name = "apicurio.auth.admin-override.claim-value", defaultValue = "true")
9090
@Info(category = "auth", description = "Auth admin override claim value", availableSince = "2.1.0.Final")
9191
String adminOverrideClaimValue;
9292

93-
@ConfigProperty(name = "registry.auth.admin-override.user", defaultValue = "admin")
93+
@ConfigProperty(name = "apicurio.auth.admin-override.user", defaultValue = "admin")
9494
@Info(category = "auth", description = "Auth admin override user name", availableSince = "3.0.0.Final")
9595
String adminOverrideUser;
9696

app/src/main/java/io/apicurio/registry/auth/AuthorizedInterceptor.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public Object authorizeMethod(InvocationContext context) throws Exception {
8080
}
8181

8282
// Anonymous users are allowed to perform read-only operations, but only if
83-
// registry.auth.anonymous-read-access.enabled is set to 'true'
83+
// apicurio.auth.anonymous-read-access.enabled is set to 'true'
8484
if (authConfig.anonymousReadAccessEnabled.get() && annotation.level() == AuthorizedLevel.Read) {
8585
log.trace("Anonymous user is being granted access to read-only operation.");
8686
return context.proceed();

app/src/main/java/io/apicurio/registry/auth/HeaderRoleProvider.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
@RequestScoped
1313
public class HeaderRoleProvider implements RoleProvider {
1414

15-
@ConfigProperty(name = "registry.auth.role-source.header.name")
15+
@ConfigProperty(name = "apicurio.auth.role-source.header.name")
1616
@Info(category = "auth", description = "Header authorization name", availableSince = "2.4.3.Final")
1717
String roleHeader;
1818

app/src/main/java/io/apicurio/registry/ccompat/rest/v7/impl/CCompatConfig.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@
1313
public class CCompatConfig {
1414

1515
@Dynamic(label = "Legacy ID mode (compatibility API)", description = "When selected, the Schema Registry compatibility API uses global ID instead of content ID for artifact identifiers.")
16-
@ConfigProperty(name = "registry.ccompat.legacy-id-mode.enabled", defaultValue = "false")
16+
@ConfigProperty(name = "apicurio.ccompat.legacy-id-mode.enabled", defaultValue = "false")
1717
@Info(category = "ccompat", description = "Legacy ID mode (compatibility API)", availableSince = "2.0.2.Final")
1818
Supplier<Boolean> legacyIdModeEnabled;
1919

2020
@Dynamic(label = "Canonical hash mode (compatibility API)", description = "When selected, the Schema Registry compatibility API uses the canonical hash instead of the regular hash of the content.")
21-
@ConfigProperty(name = "registry.ccompat.use-canonical-hash", defaultValue = "false")
21+
@ConfigProperty(name = "apicurio.ccompat.use-canonical-hash", defaultValue = "false")
2222
@Info(category = "ccompat", description = "Canonical hash mode (compatibility API)", availableSince = "2.3.0.Final")
2323
Supplier<Boolean> canonicalHashModeEnabled;
2424

2525
@Dynamic(label = "Maximum number of Subjects returned (compatibility API)", description = "Determines the maximum number of Subjects that will be returned by the ccompat API (for the '/subjects' endpoint).")
26-
@ConfigProperty(name = "registry.ccompat.max-subjects", defaultValue = "1000")
26+
@ConfigProperty(name = "apicurio.ccompat.max-subjects", defaultValue = "1000")
2727
@Info(category = "ccompat", description = "Maximum number of Subjects returned (compatibility API)", availableSince = "2.4.2.Final")
2828
Supplier<Integer> maxSubjects;
2929

app/src/main/java/io/apicurio/registry/config/RegistryStorageConfigCache.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class RegistryStorageConfigCache extends RegistryStorageDecoratorBase imp
2727
@Inject
2828
Logger log;
2929

30-
@ConfigProperty(name = "registry.config.cache.enabled", defaultValue = "true")
30+
@ConfigProperty(name = "apicurio.config.cache.enabled", defaultValue = "true")
3131
@Info(category = "cache", description = "Registry cache enabled", availableSince = "2.2.2.Final")
3232
boolean enabled;
3333

@@ -79,7 +79,7 @@ private void invalidateCache() {
7979
configCache.clear();
8080
}
8181

82-
@Scheduled(concurrentExecution = SKIP, every = "{registry.config.refresh.every}")
82+
@Scheduled(concurrentExecution = SKIP, every = "{apicurio.config.refresh.every}")
8383
void run() {
8484
if (!enabled) {
8585
return;

0 commit comments

Comments
 (0)