diff --git a/bigtable/deployment/src/main/java/io/quarkiverse/googlecloudservices/bigtable/deployment/BigtableBuildTimeConfig.java b/bigtable/deployment/src/main/java/io/quarkiverse/googlecloudservices/bigtable/deployment/BigtableBuildTimeConfig.java
index 91b39bbe..c3ce67d4 100644
--- a/bigtable/deployment/src/main/java/io/quarkiverse/googlecloudservices/bigtable/deployment/BigtableBuildTimeConfig.java
+++ b/bigtable/deployment/src/main/java/io/quarkiverse/googlecloudservices/bigtable/deployment/BigtableBuildTimeConfig.java
@@ -1,22 +1,21 @@
package io.quarkiverse.googlecloudservices.bigtable.deployment;
-import io.quarkus.runtime.annotations.ConfigItem;
-import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;
+import io.smallrye.config.ConfigMapping;
/**
* Root configuration class for Bigtable that operates at build time.
* This class provides a nested structure for configuration, including
* a separate group for the development service configuration.
*/
-@ConfigRoot(name = "google.cloud.bigtable", phase = ConfigPhase.BUILD_TIME)
-public class BigtableBuildTimeConfig {
+@ConfigMapping(prefix = "quarkus.google.cloud.bigtable")
+@ConfigRoot
+public interface BigtableBuildTimeConfig {
/**
* Configuration for the Bigtable dev service.
* These settings will be used when Bigtable service is being configured
* for development purposes.
*/
- @ConfigItem
- public BigtableDevServiceConfig devservice;
+ BigtableDevServiceConfig devservice();
}
diff --git a/bigtable/deployment/src/main/java/io/quarkiverse/googlecloudservices/bigtable/deployment/BigtableDevServiceConfig.java b/bigtable/deployment/src/main/java/io/quarkiverse/googlecloudservices/bigtable/deployment/BigtableDevServiceConfig.java
index 1a5c8b2d..0528a7d9 100644
--- a/bigtable/deployment/src/main/java/io/quarkiverse/googlecloudservices/bigtable/deployment/BigtableDevServiceConfig.java
+++ b/bigtable/deployment/src/main/java/io/quarkiverse/googlecloudservices/bigtable/deployment/BigtableDevServiceConfig.java
@@ -3,7 +3,8 @@
import java.util.Optional;
import io.quarkus.runtime.annotations.ConfigGroup;
-import io.quarkus.runtime.annotations.ConfigItem;
+import io.smallrye.config.ConfigMapping;
+import io.smallrye.config.WithDefault;
/**
* Configuration group for the Bigtable dev service. This class holds all the configuration properties
@@ -13,32 +14,32 @@
*
*
*
- * quarkus.google.cloud.bigtable.deservice.enabled = true
- * quarkus.google.cloud.bigtable.deservice.image-name = gcr.io/google.com/cloudsdktool/google-cloud-cli # optional
- * quarkus.google.cloud.bigtable.deservice.emulatorPort = 9000 # optional
+ * quarkus.google.cloud.bigtable.devservice.enabled = true
+ * quarkus.google.cloud.bigtable.devservice.image-name = gcr.io/google.com/cloudsdktool/google-cloud-cli # optional
+ * quarkus.google.cloud.bigtable.devservice.emulatorPort = 9000 # optional
*
*/
+@ConfigMapping(prefix = "quarkus.google.cloud.bigtable.devservice")
@ConfigGroup
-public class BigtableDevServiceConfig {
+public interface BigtableDevServiceConfig {
/**
* Indicates whether the Bigtable service should be enabled or not.
* The default value is 'false'.
*/
- @ConfigItem(defaultValue = "false")
- public boolean enabled;
+ @WithDefault("false")
+ boolean enabled();
/**
* Sets the Docker image name for the Google Cloud SDK.
* This image is used to emulate the Bigtable service in the development environment.
* The default value is 'gcr.io/google.com/cloudsdktool/google-cloud-cli'.
*/
- @ConfigItem(defaultValue = "gcr.io/google.com/cloudsdktool/google-cloud-cli")
- public String imageName;
+ @WithDefault("gcr.io/google.com/cloudsdktool/google-cloud-cli")
+ String imageName();
/**
* Specifies the emulatorPort on which the Bigtable service should run in the development environment.
*/
- @ConfigItem
- public Optional emulatorPort = Optional.empty();
+ Optional emulatorPort();
}
diff --git a/bigtable/deployment/src/main/java/io/quarkiverse/googlecloudservices/bigtable/deployment/BigtableDevServiceProcessor.java b/bigtable/deployment/src/main/java/io/quarkiverse/googlecloudservices/bigtable/deployment/BigtableDevServiceProcessor.java
index bc33b207..452c38f5 100644
--- a/bigtable/deployment/src/main/java/io/quarkiverse/googlecloudservices/bigtable/deployment/BigtableDevServiceProcessor.java
+++ b/bigtable/deployment/src/main/java/io/quarkiverse/googlecloudservices/bigtable/deployment/BigtableDevServiceProcessor.java
@@ -46,7 +46,7 @@ public DevServicesResultBuildItem start(DockerStatusBuildItem dockerStatusBuildI
LoggingSetupBuildItem loggingSetupBuildItem,
GlobalDevServicesConfig globalDevServicesConfig) {
// If dev service is running and config has changed, stop the service
- if (devService != null && !buildTimeConfig.devservice.equals(config)) {
+ if (devService != null && !buildTimeConfig.devservice().equals(config)) {
stopContainer();
} else if (devService != null) {
return devService.toBuildItem();
@@ -60,7 +60,7 @@ public DevServicesResultBuildItem start(DockerStatusBuildItem dockerStatusBuildI
// Try starting the container if conditions are met
try {
- devService = startContainerIfAvailable(dockerStatusBuildItem, buildTimeConfig.devservice,
+ devService = startContainerIfAvailable(dockerStatusBuildItem, buildTimeConfig.devservice(),
globalDevServicesConfig.timeout);
} catch (Throwable t) {
LOGGER.warn("Unable to start Bigtable dev service", t);
@@ -85,13 +85,13 @@ public DevServicesResultBuildItem start(DockerStatusBuildItem dockerStatusBuildI
private DevServicesResultBuildItem.RunningDevService startContainerIfAvailable(DockerStatusBuildItem dockerStatusBuildItem,
BigtableDevServiceConfig config,
Optional timeout) {
- if (!config.enabled) {
+ if (!config.enabled()) {
// Bigtable service explicitly disabled
LOGGER.debug("Not starting Dev Services for Bigtable as it has been disabled in the config");
return null;
}
- if (!dockerStatusBuildItem.isDockerAvailable()) {
+ if (!dockerStatusBuildItem.isContainerRuntimeAvailable()) {
LOGGER.warn("Not starting devservice because docker is not available");
return null;
}
@@ -112,8 +112,8 @@ private DevServicesResultBuildItem.RunningDevService startContainer(DockerStatus
Optional timeout) {
// Create and configure Bigtable emulator container
BigtableEmulatorContainer emulatorContainer = new QuarkusBigtableContainer(
- DockerImageName.parse(config.imageName).asCompatibleSubstituteFor("gcr.io/google.com/cloudsdktool/cloud-sdk"),
- config.emulatorPort.orElse(null));
+ DockerImageName.parse(config.imageName()).asCompatibleSubstituteFor("gcr.io/google.com/cloudsdktool/cloud-sdk"),
+ config.emulatorPort().orElse(null));
// Set container startup timeout if provided
timeout.ifPresent(emulatorContainer::withStartupTimeout);
diff --git a/firebase-admin/deployment/src/main/java/io/quarkiverse/googlecloudservices/firebase/admin/deployment/FirebaseAdminBuildSteps.java b/firebase-admin/deployment/src/main/java/io/quarkiverse/googlecloudservices/firebase/admin/deployment/FirebaseAdminBuildSteps.java
index 4329d360..b1630370 100644
--- a/firebase-admin/deployment/src/main/java/io/quarkiverse/googlecloudservices/firebase/admin/deployment/FirebaseAdminBuildSteps.java
+++ b/firebase-admin/deployment/src/main/java/io/quarkiverse/googlecloudservices/firebase/admin/deployment/FirebaseAdminBuildSteps.java
@@ -25,7 +25,7 @@ public AdditionalBeanBuildItem producer() {
@BuildStep
public void setupFirebaseAuth(BuildProducer additionalBeans, FirebaseAuthConfiguration config) {
- if (!config.enabled) {
+ if (!config.enabled()) {
return;
}
diff --git a/firebase-admin/deployment/src/main/java/io/quarkiverse/googlecloudservices/firebase/admin/deployment/authentication/FirebaseAuthConfiguration.java b/firebase-admin/deployment/src/main/java/io/quarkiverse/googlecloudservices/firebase/admin/deployment/authentication/FirebaseAuthConfiguration.java
index 22bb14f1..17a5a700 100644
--- a/firebase-admin/deployment/src/main/java/io/quarkiverse/googlecloudservices/firebase/admin/deployment/authentication/FirebaseAuthConfiguration.java
+++ b/firebase-admin/deployment/src/main/java/io/quarkiverse/googlecloudservices/firebase/admin/deployment/authentication/FirebaseAuthConfiguration.java
@@ -1,15 +1,16 @@
package io.quarkiverse.googlecloudservices.firebase.admin.deployment.authentication;
-import io.quarkus.runtime.annotations.ConfigItem;
-import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;
+import io.smallrye.config.ConfigMapping;
+import io.smallrye.config.WithDefault;
-@ConfigRoot(name = "google.cloud.firebase.auth", phase = ConfigPhase.BUILD_TIME)
-public class FirebaseAuthConfiguration {
+@ConfigMapping(prefix = "quarkus.google.cloud.firebase.auth")
+@ConfigRoot
+public interface FirebaseAuthConfiguration {
/**
* Enable or disable Firebase authentication.
*/
- @ConfigItem(defaultValue = "false")
- public boolean enabled;
+ @WithDefault("false")
+ boolean enabled();
}
diff --git a/firestore/deployment/src/main/java/io/quarkiverse/googlecloudservices/firestore/deployment/FirestoreBuildTimeConfig.java b/firestore/deployment/src/main/java/io/quarkiverse/googlecloudservices/firestore/deployment/FirestoreBuildTimeConfig.java
index 02f05208..381cb674 100644
--- a/firestore/deployment/src/main/java/io/quarkiverse/googlecloudservices/firestore/deployment/FirestoreBuildTimeConfig.java
+++ b/firestore/deployment/src/main/java/io/quarkiverse/googlecloudservices/firestore/deployment/FirestoreBuildTimeConfig.java
@@ -1,22 +1,21 @@
package io.quarkiverse.googlecloudservices.firestore.deployment;
-import io.quarkus.runtime.annotations.ConfigItem;
-import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;
+import io.smallrye.config.ConfigMapping;
/**
* Root configuration class for Firestore that operates at build time.
* This class provides a nested structure for configuration, including
* a separate group for the development service configuration.
*/
-@ConfigRoot(name = "google.cloud.firestore", phase = ConfigPhase.BUILD_TIME)
-public class FirestoreBuildTimeConfig {
+@ConfigMapping(prefix = "quarkus.google.cloud.firestore")
+@ConfigRoot
+public interface FirestoreBuildTimeConfig {
/**
* Configuration for the Firestore dev service.
* These settings will be used when Firestore service is being configured
* for development purposes.
*/
- @ConfigItem
- public FirestoreDevServiceConfig devservice;
+ FirestoreDevServiceConfig devservice();
}
diff --git a/firestore/deployment/src/main/java/io/quarkiverse/googlecloudservices/firestore/deployment/FirestoreDevServiceConfig.java b/firestore/deployment/src/main/java/io/quarkiverse/googlecloudservices/firestore/deployment/FirestoreDevServiceConfig.java
index 5e6739bd..cf9f7d2b 100644
--- a/firestore/deployment/src/main/java/io/quarkiverse/googlecloudservices/firestore/deployment/FirestoreDevServiceConfig.java
+++ b/firestore/deployment/src/main/java/io/quarkiverse/googlecloudservices/firestore/deployment/FirestoreDevServiceConfig.java
@@ -3,7 +3,8 @@
import java.util.Optional;
import io.quarkus.runtime.annotations.ConfigGroup;
-import io.quarkus.runtime.annotations.ConfigItem;
+import io.smallrye.config.ConfigMapping;
+import io.smallrye.config.WithDefault;
/**
* Configuration group for the Firestore dev service. This class holds all the configuration properties
@@ -13,32 +14,32 @@
*
*
*
- * quarkus.firestore-dev-service.enabled = true
- * quarkus.firestore-dev-service.image-name = gcr.io/google.com/cloudsdktool/google-cloud-cli # optional
- * quarkus.firestore-dev-service.emulatorPort = 8080 # optional
+ * quarkus.google.cloud.firestore.devservice.enabled = true
+ * quarkus.google.cloud.firestore.devservice.image-name = gcr.io/google.com/cloudsdktool/google-cloud-cli # optional
+ * quarkus.google.cloud.firestore.devservice.emulatorPort = 8080 # optional
*
*/
+@ConfigMapping(prefix = "quarkus.google.cloud.firestore.devservice")
@ConfigGroup
-public class FirestoreDevServiceConfig {
+public interface FirestoreDevServiceConfig {
/**
* Indicates whether the Firestore service should be enabled or not.
* The default value is 'false'.
*/
- @ConfigItem(defaultValue = "false")
- public boolean enabled;
+ @WithDefault("false")
+ boolean enabled();
/**
* Sets the Docker image name for the Google Cloud SDK.
* This image is used to emulate the Firestore service in the development environment.
* The default value is 'gcr.io/google.com/cloudsdktool/google-cloud-cli'.
*/
- @ConfigItem(defaultValue = "gcr.io/google.com/cloudsdktool/google-cloud-cli")
- public String imageName;
+ @WithDefault("gcr.io/google.com/cloudsdktool/google-cloud-cli")
+ String imageName();
/**
* Specifies the emulatorPort on which the Firestore service should run in the development environment.
*/
- @ConfigItem
- public Optional emulatorPort = Optional.empty();
+ Optional emulatorPort();
}
diff --git a/firestore/deployment/src/main/java/io/quarkiverse/googlecloudservices/firestore/deployment/FirestoreDevServiceProcessor.java b/firestore/deployment/src/main/java/io/quarkiverse/googlecloudservices/firestore/deployment/FirestoreDevServiceProcessor.java
index 9d0eb23c..aebcab1f 100644
--- a/firestore/deployment/src/main/java/io/quarkiverse/googlecloudservices/firestore/deployment/FirestoreDevServiceProcessor.java
+++ b/firestore/deployment/src/main/java/io/quarkiverse/googlecloudservices/firestore/deployment/FirestoreDevServiceProcessor.java
@@ -42,7 +42,7 @@ public DevServicesResultBuildItem start(DockerStatusBuildItem dockerStatusBuildI
LoggingSetupBuildItem loggingSetupBuildItem,
GlobalDevServicesConfig globalDevServicesConfig) {
// If dev service is running and config has changed, stop the service
- if (devService != null && !buildTimeConfig.devservice.equals(config)) {
+ if (devService != null && !buildTimeConfig.devservice().equals(config)) {
stopContainer();
} else if (devService != null) {
return devService.toBuildItem();
@@ -56,7 +56,7 @@ public DevServicesResultBuildItem start(DockerStatusBuildItem dockerStatusBuildI
// Try starting the container if conditions are met
try {
- devService = startContainerIfAvailable(dockerStatusBuildItem, buildTimeConfig.devservice,
+ devService = startContainerIfAvailable(dockerStatusBuildItem, buildTimeConfig.devservice(),
globalDevServicesConfig.timeout);
} catch (Throwable t) {
LOGGER.warn("Unable to start Firestore dev service", t);
@@ -81,13 +81,13 @@ public DevServicesResultBuildItem start(DockerStatusBuildItem dockerStatusBuildI
private DevServicesResultBuildItem.RunningDevService startContainerIfAvailable(DockerStatusBuildItem dockerStatusBuildItem,
FirestoreDevServiceConfig config,
Optional timeout) {
- if (!config.enabled) {
+ if (!config.enabled()) {
// Firestore service explicitly disabled
LOGGER.debug("Not starting Dev Services for Firestore as it has been disabled in the config");
return null;
}
- if (!dockerStatusBuildItem.isDockerAvailable()) {
+ if (!dockerStatusBuildItem.isContainerRuntimeAvailable()) {
LOGGER.warn("Not starting devservice because docker is not available");
return null;
}
@@ -108,8 +108,8 @@ private DevServicesResultBuildItem.RunningDevService startContainer(DockerStatus
Optional timeout) {
// Create and configure Firestore emulator container
FirestoreEmulatorContainer emulatorContainer = new QuarkusFirestoreContainer(
- DockerImageName.parse(config.imageName).asCompatibleSubstituteFor("gcr.io/google.com/cloudsdktool/cloud-sdk"),
- config.emulatorPort.orElse(null));
+ DockerImageName.parse(config.imageName()).asCompatibleSubstituteFor("gcr.io/google.com/cloudsdktool/cloud-sdk"),
+ config.emulatorPort().orElse(null));
// Set container startup timeout if provided
timeout.ifPresent(emulatorContainer::withStartupTimeout);
diff --git a/firestore/runtime/src/main/java/io/quarkiverse/googlecloudservices/firestore/runtime/FirestoreConfiguration.java b/firestore/runtime/src/main/java/io/quarkiverse/googlecloudservices/firestore/runtime/FirestoreConfiguration.java
index d59392bd..635d745f 100644
--- a/firestore/runtime/src/main/java/io/quarkiverse/googlecloudservices/firestore/runtime/FirestoreConfiguration.java
+++ b/firestore/runtime/src/main/java/io/quarkiverse/googlecloudservices/firestore/runtime/FirestoreConfiguration.java
@@ -5,83 +5,71 @@
import java.util.OptionalDouble;
import java.util.OptionalInt;
-import io.quarkus.runtime.annotations.ConfigGroup;
-import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;
+import io.smallrye.config.ConfigMapping;
-@ConfigRoot(name = "google.cloud.firestore", phase = ConfigPhase.RUN_TIME)
-public class FirestoreConfiguration {
+@ConfigMapping(prefix = "quarkus.google.cloud.firestore")
+@ConfigRoot(phase = ConfigPhase.RUN_TIME)
+public interface FirestoreConfiguration {
/**
* Overrides the default service host.
* This is most commonly used for development or testing activities with a local Google Cloud Firestore emulator instance.
*/
- @ConfigItem
- public Optional hostOverride;
+ Optional hostOverride();
/**
* Controls the retry settings for Firestore requests.
*/
- @ConfigItem
- public Optional retry;
+ Optional retry();
/**
* The firestore database identifier.
* It not set, the default will be used.
*/
- @ConfigItem
- public Optional databaseId;
+ Optional databaseId();
- @ConfigGroup
- public static class RetryConfiguration {
+ interface RetryConfiguration {
/**
* Total timeout for all retries.
*/
- @ConfigItem
- public Optional totalTimeout;
+ Optional totalTimeout();
/**
* Delay before the first retry.
*/
- @ConfigItem
- public Optional initialRetryDelay;
+ Optional initialRetryDelay();
/**
* Controls the rate of change of the delay. Next retry is multiplied by this factor.
*/
- @ConfigItem
- public OptionalDouble retryDelayMultiplier;
+ OptionalDouble retryDelayMultiplier();
/**
* Limits the maximum retry delay.
*/
- @ConfigItem
- public Optional maxRetryDelay;
+ Optional maxRetryDelay();
/**
* Determines the maximum number of attempts. When number of attempts reach this limit they stop retrying.
*/
- @ConfigItem
- public OptionalInt maxAttempts;
+ OptionalInt maxAttempts();
/**
* Timeout for the initial RPC.
*/
- @ConfigItem
- public Optional initialRpcTimeout;
+ Optional initialRpcTimeout();
/**
* Controls the rate of change of the RPC timeout. Next timeout is multiplied by this factor.
*/
- @ConfigItem
- public OptionalDouble rpcTimeoutMultiplier;
+ OptionalDouble rpcTimeoutMultiplier();
/**
* Limits the maximum RPC timeout.
*/
- @ConfigItem
- public Optional maxRpcTimeout;
+ Optional maxRpcTimeout();
}
}
diff --git a/firestore/runtime/src/main/java/io/quarkiverse/googlecloudservices/firestore/runtime/FirestoreProducer.java b/firestore/runtime/src/main/java/io/quarkiverse/googlecloudservices/firestore/runtime/FirestoreProducer.java
index b2b4808f..b3952043 100644
--- a/firestore/runtime/src/main/java/io/quarkiverse/googlecloudservices/firestore/runtime/FirestoreProducer.java
+++ b/firestore/runtime/src/main/java/io/quarkiverse/googlecloudservices/firestore/runtime/FirestoreProducer.java
@@ -44,26 +44,26 @@ public Firestore firestore() throws IOException {
.setProjectId(gcpConfiguration.projectId().orElse(null));
if (useEmulatorCredentials()) {
builder.setCredentials(new FirestoreOptions.EmulatorCredentials());
- firestoreConfiguration.hostOverride.ifPresent(builder::setEmulatorHost);
+ firestoreConfiguration.hostOverride().ifPresent(builder::setEmulatorHost);
} else {
builder.setCredentials(googleCredentials.get());
- firestoreConfiguration.hostOverride.ifPresent(builder::setHost);
- firestoreConfiguration.retry.map(this::buildRetrySettings).ifPresent(builder::setRetrySettings);
- firestoreConfiguration.databaseId.ifPresent(builder::setDatabaseId);
+ firestoreConfiguration.hostOverride().ifPresent(builder::setHost);
+ firestoreConfiguration.retry().map(this::buildRetrySettings).ifPresent(builder::setRetrySettings);
+ firestoreConfiguration.databaseId().ifPresent(builder::setDatabaseId);
}
return builder.build().getService();
}
private RetrySettings buildRetrySettings(RetryConfiguration retryConfiguration) {
RetrySettings.Builder retrySettingsBuilder = RetrySettings.newBuilder();
- retryConfiguration.totalTimeout.ifPresent(d -> retrySettingsBuilder.setTotalTimeout(convertDuration(d)));
- retryConfiguration.initialRetryDelay.ifPresent(d -> retrySettingsBuilder.setInitialRetryDelay(convertDuration(d)));
- retryConfiguration.retryDelayMultiplier.ifPresent(retrySettingsBuilder::setRetryDelayMultiplier);
- retryConfiguration.maxRetryDelay.ifPresent(d -> retrySettingsBuilder.setMaxRetryDelay(convertDuration(d)));
- retryConfiguration.maxAttempts.ifPresent(retrySettingsBuilder::setMaxAttempts);
- retryConfiguration.initialRpcTimeout.ifPresent(d -> retrySettingsBuilder.setInitialRpcTimeout(convertDuration(d)));
- retryConfiguration.rpcTimeoutMultiplier.ifPresent(retrySettingsBuilder::setRpcTimeoutMultiplier);
- retryConfiguration.maxRpcTimeout.ifPresent(d -> retrySettingsBuilder.setMaxRpcTimeout(convertDuration(d)));
+ retryConfiguration.totalTimeout().ifPresent(d -> retrySettingsBuilder.setTotalTimeout(convertDuration(d)));
+ retryConfiguration.initialRetryDelay().ifPresent(d -> retrySettingsBuilder.setInitialRetryDelay(convertDuration(d)));
+ retryConfiguration.retryDelayMultiplier().ifPresent(retrySettingsBuilder::setRetryDelayMultiplier);
+ retryConfiguration.maxRetryDelay().ifPresent(d -> retrySettingsBuilder.setMaxRetryDelay(convertDuration(d)));
+ retryConfiguration.maxAttempts().ifPresent(retrySettingsBuilder::setMaxAttempts);
+ retryConfiguration.initialRpcTimeout().ifPresent(d -> retrySettingsBuilder.setInitialRpcTimeout(convertDuration(d)));
+ retryConfiguration.rpcTimeoutMultiplier().ifPresent(retrySettingsBuilder::setRpcTimeoutMultiplier);
+ retryConfiguration.maxRpcTimeout().ifPresent(d -> retrySettingsBuilder.setMaxRpcTimeout(convertDuration(d)));
return retrySettingsBuilder.build();
}
@@ -85,8 +85,8 @@ private Duration convertDuration(java.time.Duration duration) {
*/
private boolean useEmulatorCredentials() {
return !this.gcpBootstrapConfiguration.accessTokenEnabled()
- && this.firestoreConfiguration.hostOverride.isPresent()
- && this.firestoreConfiguration.hostOverride.get().contains("localhost");
+ && this.firestoreConfiguration.hostOverride().isPresent()
+ && this.firestoreConfiguration.hostOverride().get().contains("localhost");
}
}
diff --git a/logging/runtime/pom.xml b/logging/runtime/pom.xml
index c58b5350..13541726 100644
--- a/logging/runtime/pom.xml
+++ b/logging/runtime/pom.xml
@@ -58,6 +58,11 @@
quarkus-junit5
test
+
+ io.quarkus
+ quarkus-junit5-component
+ test
+
diff --git a/logging/runtime/src/main/java/io/quarkiverse/googlecloudservices/logging/runtime/LoggingConfiguration.java b/logging/runtime/src/main/java/io/quarkiverse/googlecloudservices/logging/runtime/LoggingConfiguration.java
index aa9c8312..e144b302 100644
--- a/logging/runtime/src/main/java/io/quarkiverse/googlecloudservices/logging/runtime/LoggingConfiguration.java
+++ b/logging/runtime/src/main/java/io/quarkiverse/googlecloudservices/logging/runtime/LoggingConfiguration.java
@@ -7,52 +7,49 @@
import com.google.cloud.logging.Severity;
import com.google.cloud.logging.Synchronicity;
-import io.quarkus.runtime.annotations.ConfigGroup;
-import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;
+import io.smallrye.config.ConfigMapping;
+import io.smallrye.config.WithDefault;
-@ConfigRoot(name = "google.cloud.logging", phase = ConfigPhase.RUN_TIME)
-public class LoggingConfiguration {
+@ConfigMapping(prefix = "quarkus.google.cloud.logging")
+@ConfigRoot(phase = ConfigPhase.RUN_TIME)
+public interface LoggingConfiguration {
/**
* Which Google Operations log should be used by default.
*/
- @ConfigItem
- public String defaultLog;
+ String defaultLog();
/**
* Enable or disable the Google Cloud logging.
*/
- @ConfigItem(defaultValue = "true")
- public boolean enabled;
+ @WithDefault("true")
+ boolean enabled();
/**
* Configure base formatting to be either plain text or
* structured json. Allowed values: TEXT|JSON
*/
- @ConfigItem(defaultValue = "TEXT")
- public LogFormat format;
+ @WithDefault("TEXT")
+ LogFormat format();
/**
* Configure GCP logging synchronicity. Allowed values:
* SYNC|ASYNC
*/
- @ConfigItem
- public Optional synchronicity;
+ Optional synchronicity();
/**
* Configure auto flush level. Allowed values:
* DEBUG|INFO|WARN|ERROR|FATAL
*/
- @ConfigItem
- public Optional flushLevel;
+ Optional flushLevel();
/**
* Configure default labels.
*/
- @ConfigItem
- public Map defaultLabel;
+ Map defaultLabel();
/**
* Configured the monitored resource. Please consult the Google
@@ -60,132 +57,118 @@ public class LoggingConfiguration {
*
* @see https://cloud.google.com/logging/docs/api/v2/resource-list#resource-types
*/
- @ConfigItem
- public ResourceConfig resource;
+ ResourceConfig resource();
/**
* Configure how trace information is handled in GCP.
*/
- @ConfigItem
- public GcpTracingConfig gcpTracing;
+ GcpTracingConfig gcpTracing();
/**
* Configuration options for structured logging.
*/
- @ConfigItem
- public StructuredConfig structured;
+ StructuredConfig structured();
/**
* Configures if logs should be written to stdout or stderr instead of using Google Cloud Operations API.
* Useful if app is deployed to managed Google Cloud Platform environment with installed logger agent.
* Possible values: STDOUT, STDERR and CLOUD_LOGGING.
*/
- @ConfigItem(defaultValue = "CLOUD_LOGGING")
- public LogTarget logTarget;
+ @WithDefault("CLOUD_LOGGING")
+ LogTarget logTarget();
- @ConfigGroup
- public static class StructuredConfig {
+ interface StructuredConfig {
/**
* Configure log record stack trace handling.
*/
- @ConfigItem
- public StackTraceConfig stackTrace;
+ StackTraceConfig stackTrace();
/**
* Configure log record MDC handling.
*/
- @ConfigItem
- public MDCConfig mdc;
+ MDCConfig mdc();
/**
* Configure log record parameter handling.
*/
- @ConfigItem
- public ParametersConfig parameters;
+ ParametersConfig parameters();
}
- @ConfigGroup
- public static class GcpTracingConfig {
+ interface GcpTracingConfig {
/**
* Use this setting to determine if extracted trace ID's should
* also be forwarded to GCP for linking with GCP Operations Tracing.
*/
- @ConfigItem(defaultValue = "true")
- public boolean enabled;
+ @WithDefault("true")
+ boolean enabled();
/**
* If the GCP Operations Tracing is in another project, configure it
* here. By default the logging project will be used.
*/
- @ConfigItem
- public Optional projectId;
+ Optional projectId();
}
- @ConfigGroup
- public static class ResourceConfig {
+ interface ResourceConfig {
/**
* The resource type of the log.
*/
- @ConfigItem(defaultValue = "global")
- public String type;
+ @WithDefault("global")
+ String type();
/**
* Resource labels.
*/
- @ConfigItem
- public Map label;
+ Map label();
}
- @ConfigGroup
- public static class MDCConfig {
+ interface MDCConfig {
/**
* Include MDC values in the log.
*/
- @ConfigItem(defaultValue = "true")
- public boolean included;
+ @WithDefault("true")
+ boolean included();
/**
* Field name for MDC values, defaults to 'mdc'.
*/
- @ConfigItem(defaultValue = "mdc")
- public String fieldName;
+ @WithDefault("mdc")
+ String fieldName();
}
- @ConfigGroup
- public static class StackTraceConfig {
+ interface StackTraceConfig {
/**
* Include stack traces when exceptions are thrown.
*/
- @ConfigItem(defaultValue = "true")
- public boolean included;
+ @WithDefault("true")
+ boolean included();
}
- @ConfigGroup
- public static class ParametersConfig {
+ interface ParametersConfig {
/**
* Include parameter values in the log.
*/
- @ConfigItem(defaultValue = "true")
- public boolean included;
+ @WithDefault("true")
+ boolean included();
/**
* Field name for parameter values, defaults to 'parameters'.
*/
- @ConfigItem(defaultValue = "parameters")
- public String fieldName;
+ @WithDefault("parameters")
+ String fieldName();
}
- public enum ConfigLevel {
+ enum ConfigLevel {
DEBUG(Severity.DEBUG),
INFO(Severity.INFO),
WARN(Severity.WARNING),
@@ -203,7 +186,7 @@ public Severity getSeverity() {
}
}
- public enum LogFormat {
+ enum LogFormat {
TEXT,
JSON
}
diff --git a/logging/runtime/src/main/java/io/quarkiverse/googlecloudservices/logging/runtime/LoggingHandler.java b/logging/runtime/src/main/java/io/quarkiverse/googlecloudservices/logging/runtime/LoggingHandler.java
index 4344717b..37180668 100644
--- a/logging/runtime/src/main/java/io/quarkiverse/googlecloudservices/logging/runtime/LoggingHandler.java
+++ b/logging/runtime/src/main/java/io/quarkiverse/googlecloudservices/logging/runtime/LoggingHandler.java
@@ -59,7 +59,7 @@ public void doPublish(ExtLogRecord record) {
TraceInfo trace = traceExtractor.extract(record);
LogEntry logEntry = transform(record, trace);
if (logEntry != null) {
- switch (config.logTarget) {
+ switch (config.logTarget()) {
case STDOUT:
System.out.println(logEntry.toStructuredJsonString());
break;
@@ -82,7 +82,7 @@ private LogEntry transform(ExtLogRecord record, TraceInfo trace) {
com.google.cloud.logging.LogEntry.Builder builder = LogEntry.newBuilder(payload)
.setSeverity(LevelTransformer.toSeverity(record.getLevel()))
.setTimestamp(record.getInstant());
- if (this.config.gcpTracing.enabled && trace != null && !Strings.isNullOrEmpty(trace.getTraceId())) {
+ if (this.config.gcpTracing().enabled() && trace != null && !Strings.isNullOrEmpty(trace.getTraceId())) {
builder = builder.setTrace(composeTraceString(trace.getTraceId()));
}
return builder.build();
@@ -92,7 +92,7 @@ private LogEntry transform(ExtLogRecord record, TraceInfo trace) {
}
private String composeTraceString(String traceId) {
- return String.format("projects/%s/traces/%s", this.config.gcpTracing.projectId.orElse(null), traceId);
+ return String.format("projects/%s/traces/%s", this.config.gcpTracing().projectId().orElse(null), traceId);
}
@Override
@@ -121,7 +121,7 @@ private synchronized Logging initGetLogging() {
}
private void initInternalHandler() {
- if (this.config.format == LogFormat.JSON) {
+ if (this.config.format() == LogFormat.JSON) {
this.internalHandler = new JsonHandler(this.config, getErrorManager());
} else {
this.internalHandler = new TextHandler();
@@ -139,16 +139,16 @@ private void initTraceExtractor() {
private void initDefaultWriteOptions() {
this.defaultWriteOptions = new WriteOption[] {
- WriteOption.logName(this.config.defaultLog),
+ WriteOption.logName(this.config.defaultLog()),
WriteOption.resource(createMonitoredResource()),
- WriteOption.labels(this.config.defaultLabel == null ? Collections.emptyMap() : this.config.defaultLabel)
+ WriteOption.labels(this.config.defaultLabel() == null ? Collections.emptyMap() : this.config.defaultLabel())
};
}
private MonitoredResource createMonitoredResource() {
- MonitoredResource.Builder b = MonitoredResource.newBuilder(this.config.resource.type);
- if (this.config.resource.label != null) {
- this.config.resource.label.forEach(b::addLabel);
+ MonitoredResource.Builder b = MonitoredResource.newBuilder(this.config.resource().type());
+ if (this.config.resource().label() != null) {
+ this.config.resource().label().forEach(b::addLabel);
}
return b.build();
}
diff --git a/logging/runtime/src/main/java/io/quarkiverse/googlecloudservices/logging/runtime/cdi/LoggingProducer.java b/logging/runtime/src/main/java/io/quarkiverse/googlecloudservices/logging/runtime/cdi/LoggingProducer.java
index 06d3521d..400df2cf 100644
--- a/logging/runtime/src/main/java/io/quarkiverse/googlecloudservices/logging/runtime/cdi/LoggingProducer.java
+++ b/logging/runtime/src/main/java/io/quarkiverse/googlecloudservices/logging/runtime/cdi/LoggingProducer.java
@@ -42,8 +42,8 @@ public Logging create() {
.build()
.getService();
// check auto-flush and synchronicity
- loggingConfig.flushLevel.ifPresent(level -> log.setFlushSeverity(level.getSeverity()));
- loggingConfig.synchronicity.ifPresent(sync -> log.setWriteSynchronicity(sync));
+ loggingConfig.flushLevel().ifPresent(level -> log.setFlushSeverity(level.getSeverity()));
+ loggingConfig.synchronicity().ifPresent(sync -> log.setWriteSynchronicity(sync));
return log;
}
}
diff --git a/logging/runtime/src/main/java/io/quarkiverse/googlecloudservices/logging/runtime/ecs/EscJsonFormat.java b/logging/runtime/src/main/java/io/quarkiverse/googlecloudservices/logging/runtime/ecs/EscJsonFormat.java
index 8cd48d01..16614c97 100644
--- a/logging/runtime/src/main/java/io/quarkiverse/googlecloudservices/logging/runtime/ecs/EscJsonFormat.java
+++ b/logging/runtime/src/main/java/io/quarkiverse/googlecloudservices/logging/runtime/ecs/EscJsonFormat.java
@@ -81,8 +81,8 @@ protected void putTracing(Map m, TraceInfo tracing) {
@SuppressWarnings("unchecked")
protected void putParametersIfEnabled(Map m, Object[] parameters) {
- if (parameters != null && parameters.length > 0 && this.config.structured.parameters.included) {
- List list = (List) m.computeIfAbsent(this.config.structured.parameters.fieldName,
+ if (parameters != null && parameters.length > 0 && this.config.structured().parameters().included()) {
+ List list = (List) m.computeIfAbsent(this.config.structured().parameters().fieldName(),
(k) -> new ArrayList(parameters.length));
for (Object o : parameters) {
if (shouldIncludeParameter(o)) {
@@ -110,7 +110,7 @@ protected void putThrown(Map m, Throwable thrown) {
if (!Strings.isNullOrEmpty(msg)) {
error.put("message", msg);
}
- if (this.config.structured.stackTrace.included) {
+ if (this.config.structured().stackTrace().included()) {
// render as a standard out string
StringWriter sw = new StringWriter(1024);
PrintWriter pw = new PrintWriter(sw);
@@ -122,8 +122,8 @@ protected void putThrown(Map m, Throwable thrown) {
}
protected void putMdcIfEnabled(Map m, Map mdcCopy) {
- if (mdcCopy != null && !mdcCopy.isEmpty() && this.config.structured.mdc.included) {
- Map mdc = getOrCreateObject(m, this.config.structured.mdc.fieldName);
+ if (mdcCopy != null && !mdcCopy.isEmpty() && this.config.structured().mdc().included()) {
+ Map mdc = getOrCreateObject(m, this.config.structured().mdc().fieldName());
mdcCopy.forEach((k, v) -> mdc.put(k, v));
}
}
diff --git a/logging/runtime/src/main/java/io/quarkiverse/googlecloudservices/logging/runtime/recorder/LoggingHandlerFactory.java b/logging/runtime/src/main/java/io/quarkiverse/googlecloudservices/logging/runtime/recorder/LoggingHandlerFactory.java
index b669c74f..b76a7964 100644
--- a/logging/runtime/src/main/java/io/quarkiverse/googlecloudservices/logging/runtime/recorder/LoggingHandlerFactory.java
+++ b/logging/runtime/src/main/java/io/quarkiverse/googlecloudservices/logging/runtime/recorder/LoggingHandlerFactory.java
@@ -17,11 +17,11 @@ public class LoggingHandlerFactory {
private static final Logger LOG = LoggerFactory.getLogger(LoggingHandlerFactory.class);
public RuntimeValue> create(LoggingConfiguration config) {
- if (!config.enabled) {
+ if (!config.enabled()) {
LOG.info("GCP logging is disabled");
return new RuntimeValue<>(Optional.empty());
} else {
- LOG.info("GCP logging handler created for default log: {}", config.defaultLog);
+ LOG.info("GCP logging handler created for default log: {}", config.defaultLog());
return new RuntimeValue<>(Optional.of(new LoggingHandler(config)));
}
}
diff --git a/logging/runtime/src/test/java/io/quarkiverse/googlecloudservices/logging/runtime/ecs/EscJsonFormatTest.java b/logging/runtime/src/test/java/io/quarkiverse/googlecloudservices/logging/runtime/ecs/EscJsonFormatTest.java
index fafc3597..8b2968ac 100644
--- a/logging/runtime/src/test/java/io/quarkiverse/googlecloudservices/logging/runtime/ecs/EscJsonFormatTest.java
+++ b/logging/runtime/src/test/java/io/quarkiverse/googlecloudservices/logging/runtime/ecs/EscJsonFormatTest.java
@@ -1,5 +1,7 @@
package io.quarkiverse.googlecloudservices.logging.runtime.ecs;
+import static org.mockito.Mockito.when;
+
import java.util.Map;
import java.util.UUID;
import java.util.logging.Level;
@@ -7,6 +9,7 @@
import org.jboss.logmanager.ExtLogRecord;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
@@ -91,7 +94,7 @@ public void testSourceClassLineAndMethod() {
public void testExcludeMdcAccordingToConfig() {
EscJsonFormat f = new EscJsonFormat();
LoggingConfiguration c = createNewLoggingConfiguration();
- c.structured.mdc.included = false;
+ when(c.structured().mdc().included()).thenReturn(false);
f.setLoggingConfiguration(c);
ExtLogRecord r = createNewLogRecord();
r.setMdc(Map.of("k", "v"));
@@ -103,8 +106,7 @@ public void testExcludeMdcAccordingToConfig() {
public void testMdcFieldName() {
EscJsonFormat f = new EscJsonFormat();
LoggingConfiguration c = createNewLoggingConfiguration();
- c.structured.mdc.included = true;
- c.structured.mdc.fieldName = "fieldName";
+ when(c.structured().mdc().fieldName()).thenReturn("fieldName");
f.setLoggingConfiguration(c);
ExtLogRecord r = createNewLogRecord();
r.setMdc(Map.of("k", "v"));
@@ -128,7 +130,7 @@ public void testThrownTypeMessageAndStringStackTrace() {
public void testExcludeStackTrace() {
EscJsonFormat f = new EscJsonFormat();
LoggingConfiguration c = createNewLoggingConfiguration();
- c.structured.stackTrace.included = false;
+ when(c.structured().stackTrace().included()).thenReturn(false);
f.setLoggingConfiguration(c);
ExtLogRecord r = createNewLogRecord();
r.setThrown(new Exception("hello exception"));
@@ -152,7 +154,7 @@ public void testHost() {
public void testExcludeParameters() {
EscJsonFormat f = new EscJsonFormat();
LoggingConfiguration c = createNewLoggingConfiguration();
- c.structured.parameters.included = false;
+ when(c.structured().parameters().included()).thenReturn(false);
f.setLoggingConfiguration(c);
ExtLogRecord r = createNewLogRecord();
r.setParameters(new Object[] { "p1", "p2" });
@@ -164,7 +166,6 @@ public void testExcludeParameters() {
public void testIncludeParameters() {
EscJsonFormat f = new EscJsonFormat();
LoggingConfiguration c = createNewLoggingConfiguration();
- c.structured.parameters.included = true;
f.setLoggingConfiguration(c);
ExtLogRecord r = createNewLogRecord();
r.setParameters(new Object[] { "p1", "p2" });
@@ -222,15 +223,23 @@ private EscJsonFormat createConfiguredFormat() {
}
private LoggingConfiguration createNewLoggingConfiguration() {
- LoggingConfiguration c = new LoggingConfiguration();
- c.structured = new StructuredConfig();
- c.structured.mdc = new MDCConfig();
- c.structured.mdc.included = true;
- c.structured.stackTrace = new StackTraceConfig();
- c.structured.stackTrace.included = true;
- c.structured.parameters = new ParametersConfig();
- c.structured.parameters.included = true;
- c.structured.parameters.fieldName = "parameters";
+ LoggingConfiguration c = Mockito.mock(LoggingConfiguration.class);
+ StructuredConfig structured = Mockito.mock(StructuredConfig.class);
+ MDCConfig mdc = Mockito.mock(MDCConfig.class);
+ StackTraceConfig stackTrace = Mockito.mock(StackTraceConfig.class);
+ ParametersConfig parameters = Mockito.mock(ParametersConfig.class);
+
+ when(mdc.included()).thenReturn(true);
+ when(stackTrace.included()).thenReturn(true);
+ when(parameters.included()).thenReturn(true);
+ when(parameters.fieldName()).thenReturn("parameters");
+
+ when(structured.mdc()).thenReturn(mdc);
+ when(structured.stackTrace()).thenReturn(stackTrace);
+ when(structured.parameters()).thenReturn(parameters);
+
+ when(c.structured()).thenReturn(structured);
+
return c;
}
diff --git a/pubsub/deployment/src/main/java/io/quarkiverse/googlecloudservices/pubsub/deployment/PubSubBuildTimeConfig.java b/pubsub/deployment/src/main/java/io/quarkiverse/googlecloudservices/pubsub/deployment/PubSubBuildTimeConfig.java
index c04d5176..b7963d4b 100644
--- a/pubsub/deployment/src/main/java/io/quarkiverse/googlecloudservices/pubsub/deployment/PubSubBuildTimeConfig.java
+++ b/pubsub/deployment/src/main/java/io/quarkiverse/googlecloudservices/pubsub/deployment/PubSubBuildTimeConfig.java
@@ -1,22 +1,21 @@
package io.quarkiverse.googlecloudservices.pubsub.deployment;
-import io.quarkus.runtime.annotations.ConfigItem;
-import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;
+import io.smallrye.config.ConfigMapping;
/**
* Root configuration class for Google Cloud Pub/Sub that operates at build time.
* This class provides a nested structure for configuration, including
* a separate group for the development service configuration.
*/
-@ConfigRoot(name = "google.cloud.pubsub", phase = ConfigPhase.BUILD_TIME)
-public class PubSubBuildTimeConfig {
+@ConfigMapping(prefix = "quarkus.google.cloud.pubsub")
+@ConfigRoot
+public interface PubSubBuildTimeConfig {
/**
* Configuration for the Pub/Sub dev service.
* These settings will be used when Pub/Sub service is being configured
* for development purposes.
*/
- @ConfigItem
- public PubSubDevServiceConfig devservice;
+ PubSubDevServiceConfig devservice();
}
diff --git a/pubsub/deployment/src/main/java/io/quarkiverse/googlecloudservices/pubsub/deployment/PubSubDevServiceConfig.java b/pubsub/deployment/src/main/java/io/quarkiverse/googlecloudservices/pubsub/deployment/PubSubDevServiceConfig.java
index f18b5cb3..e0378244 100644
--- a/pubsub/deployment/src/main/java/io/quarkiverse/googlecloudservices/pubsub/deployment/PubSubDevServiceConfig.java
+++ b/pubsub/deployment/src/main/java/io/quarkiverse/googlecloudservices/pubsub/deployment/PubSubDevServiceConfig.java
@@ -3,7 +3,8 @@
import java.util.Optional;
import io.quarkus.runtime.annotations.ConfigGroup;
-import io.quarkus.runtime.annotations.ConfigItem;
+import io.smallrye.config.ConfigMapping;
+import io.smallrye.config.WithDefault;
/**
* Configuration group for the Pub/Sub. This class holds all the configuration properties
@@ -13,32 +14,32 @@
*
*
*
- * quarkus.pub-sub-dev-service.enabled = true
- * quarkus.pub-sub-dev-service.image-name = gcr.io/google.com/cloudsdktool/google-cloud-cli # optional
- * quarkus.pub-sub-dev-service.emulatorPort = 8085 # optional
+ * quarkus.google.cloud.pubsub.devservice.enabled = true
+ * quarkus.google.cloud.pubsub.devservice.image-name = gcr.io/google.com/cloudsdktool/google-cloud-cli # optional
+ * quarkus.google.cloud.pubsub.devservice.emulatorPort = 8085 # optional
*
*/
+@ConfigMapping(prefix = "quarkus.google.cloud.pubsub.devservice")
@ConfigGroup
-public class PubSubDevServiceConfig {
+public interface PubSubDevServiceConfig {
/**
* Indicates whether the Pub/Sub service should be enabled or not.
* The default value is 'false'.
*/
- @ConfigItem(defaultValue = "false")
- public boolean enabled;
+ @WithDefault("false")
+ boolean enabled();
/**
* Sets the Docker image name for the Google Cloud SDK.
* This image is used to emulate the Pub/Sub service in the development environment.
* The default value is 'gcr.io/google.com/cloudsdktool/google-cloud-cli'.
*/
- @ConfigItem(name = "image-name", defaultValue = "gcr.io/google.com/cloudsdktool/google-cloud-cli")
- public String imageName;
+ @WithDefault("gcr.io/google.com/cloudsdktool/google-cloud-cli")
+ String imageName();
/**
* Specifies the emulatorPort on which the Pub/Sub service should run in the development environment.
*/
- @ConfigItem
- public Optional emulatorPort = Optional.empty();
+ Optional emulatorPort();
}
diff --git a/pubsub/deployment/src/main/java/io/quarkiverse/googlecloudservices/pubsub/deployment/PubSubDevServiceProcessor.java b/pubsub/deployment/src/main/java/io/quarkiverse/googlecloudservices/pubsub/deployment/PubSubDevServiceProcessor.java
index 62c99868..096914f4 100644
--- a/pubsub/deployment/src/main/java/io/quarkiverse/googlecloudservices/pubsub/deployment/PubSubDevServiceProcessor.java
+++ b/pubsub/deployment/src/main/java/io/quarkiverse/googlecloudservices/pubsub/deployment/PubSubDevServiceProcessor.java
@@ -42,7 +42,7 @@ public DevServicesResultBuildItem start(DockerStatusBuildItem dockerStatusBuildI
LoggingSetupBuildItem loggingSetupBuildItem,
GlobalDevServicesConfig globalDevServicesConfig) {
// If dev service is running and config has changed, stop the service
- if (devService != null && !pubSubBuildTimeConfig.devservice.equals(config)) {
+ if (devService != null && !pubSubBuildTimeConfig.devservice().equals(config)) {
stopContainer();
} else if (devService != null) {
return devService.toBuildItem();
@@ -56,7 +56,7 @@ public DevServicesResultBuildItem start(DockerStatusBuildItem dockerStatusBuildI
// Try starting the container if conditions are met
try {
- devService = startContainerIfAvailable(dockerStatusBuildItem, pubSubBuildTimeConfig.devservice,
+ devService = startContainerIfAvailable(dockerStatusBuildItem, pubSubBuildTimeConfig.devservice(),
globalDevServicesConfig.timeout);
} catch (Throwable t) {
LOGGER.warn("Unable to start PubSub dev service", t);
@@ -81,13 +81,13 @@ public DevServicesResultBuildItem start(DockerStatusBuildItem dockerStatusBuildI
private DevServicesResultBuildItem.RunningDevService startContainerIfAvailable(DockerStatusBuildItem dockerStatusBuildItem,
PubSubDevServiceConfig config,
Optional timeout) {
- if (!config.enabled) {
+ if (!config.enabled()) {
// PubSub service explicitly disabled
LOGGER.debug("Not starting Dev Services for PubSub as it has been disabled in the config");
return null;
}
- if (!dockerStatusBuildItem.isDockerAvailable()) {
+ if (!dockerStatusBuildItem.isContainerRuntimeAvailable()) {
LOGGER.warn("Not starting devservice because docker is not available");
return null;
}
@@ -108,8 +108,8 @@ private DevServicesResultBuildItem.RunningDevService startContainer(DockerStatus
Optional timeout) {
// Create and configure Pub/Sub emulator container
PubSubEmulatorContainer emulatorContainer = new QuarkusPubSubContainer(
- DockerImageName.parse(config.imageName).asCompatibleSubstituteFor("gcr.io/google.com/cloudsdktool/cloud-sdk"),
- config.emulatorPort.orElse(null));
+ DockerImageName.parse(config.imageName()).asCompatibleSubstituteFor("gcr.io/google.com/cloudsdktool/cloud-sdk"),
+ config.emulatorPort().orElse(null));
// Set container startup timeout if provided
timeout.ifPresent(emulatorContainer::withStartupTimeout);
diff --git a/pubsub/runtime/src/main/java/io/quarkiverse/googlecloudservices/pubsub/PubSubConfiguration.java b/pubsub/runtime/src/main/java/io/quarkiverse/googlecloudservices/pubsub/PubSubConfiguration.java
index 75469e5a..41d5da87 100644
--- a/pubsub/runtime/src/main/java/io/quarkiverse/googlecloudservices/pubsub/PubSubConfiguration.java
+++ b/pubsub/runtime/src/main/java/io/quarkiverse/googlecloudservices/pubsub/PubSubConfiguration.java
@@ -2,16 +2,16 @@
import java.util.Optional;
-import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;
+import io.smallrye.config.ConfigMapping;
-@ConfigRoot(name = "google.cloud.pubsub", phase = ConfigPhase.RUN_TIME)
-public class PubSubConfiguration {
+@ConfigMapping(prefix = "quarkus.google.cloud.pubsub")
+@ConfigRoot(phase = ConfigPhase.RUN_TIME)
+public interface PubSubConfiguration {
/**
* Enable emulator and set its host.
*/
- @ConfigItem
- public Optional emulatorHost;
+ Optional emulatorHost();
}
diff --git a/pubsub/runtime/src/main/java/io/quarkiverse/googlecloudservices/pubsub/QuarkusPubSub.java b/pubsub/runtime/src/main/java/io/quarkiverse/googlecloudservices/pubsub/QuarkusPubSub.java
index 30cf3ec9..75738c8a 100644
--- a/pubsub/runtime/src/main/java/io/quarkiverse/googlecloudservices/pubsub/QuarkusPubSub.java
+++ b/pubsub/runtime/src/main/java/io/quarkiverse/googlecloudservices/pubsub/QuarkusPubSub.java
@@ -35,8 +35,8 @@ public class QuarkusPubSub {
@PostConstruct
void init() {
- if (pubSubConfiguration.emulatorHost.isPresent()) {
- ManagedChannel channel = ManagedChannelBuilder.forTarget(pubSubConfiguration.emulatorHost.get()).usePlaintext()
+ if (pubSubConfiguration.emulatorHost().isPresent()) {
+ ManagedChannel channel = ManagedChannelBuilder.forTarget(pubSubConfiguration.emulatorHost().get()).usePlaintext()
.build();
channelProvider = Optional.of(FixedTransportChannelProvider.create(GrpcTransportChannel.create(channel)));
} else {
diff --git a/spanner/runtime/src/main/java/io/quarkiverse/googlecloudservices/spanner/runtime/SpannerConfiguration.java b/spanner/runtime/src/main/java/io/quarkiverse/googlecloudservices/spanner/runtime/SpannerConfiguration.java
index 566e8914..c89d8987 100644
--- a/spanner/runtime/src/main/java/io/quarkiverse/googlecloudservices/spanner/runtime/SpannerConfiguration.java
+++ b/spanner/runtime/src/main/java/io/quarkiverse/googlecloudservices/spanner/runtime/SpannerConfiguration.java
@@ -2,15 +2,15 @@
import java.util.Optional;
-import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;
+import io.smallrye.config.ConfigMapping;
-@ConfigRoot(name = "google.cloud.spanner", phase = ConfigPhase.RUN_TIME)
-public class SpannerConfiguration {
+@ConfigMapping(prefix = "quarkus.google.cloud.spanner")
+@ConfigRoot(phase = ConfigPhase.RUN_TIME)
+public interface SpannerConfiguration {
/**
* Enable emulator and set its host.
*/
- @ConfigItem
- public Optional emulatorHost;
+ Optional emulatorHost();
}
diff --git a/spanner/runtime/src/main/java/io/quarkiverse/googlecloudservices/spanner/runtime/SpannerProducer.java b/spanner/runtime/src/main/java/io/quarkiverse/googlecloudservices/spanner/runtime/SpannerProducer.java
index 387b0c2b..81457f1b 100644
--- a/spanner/runtime/src/main/java/io/quarkiverse/googlecloudservices/spanner/runtime/SpannerProducer.java
+++ b/spanner/runtime/src/main/java/io/quarkiverse/googlecloudservices/spanner/runtime/SpannerProducer.java
@@ -1,7 +1,5 @@
package io.quarkiverse.googlecloudservices.spanner.runtime;
-import java.io.IOException;
-
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.inject.Default;
import jakarta.enterprise.inject.Produces;
@@ -29,11 +27,11 @@ public class SpannerProducer {
@Produces
@Singleton
@Default
- public Spanner storage() throws IOException {
+ public Spanner storage() {
GcpBootstrapConfiguration gcpConfiguration = gcpConfigHolder.getBootstrapConfig();
SpannerOptions.Builder builder = SpannerOptions.newBuilder().setCredentials(googleCredentials)
.setProjectId(gcpConfiguration.projectId().orElse(null));
- spannerConfiguration.emulatorHost.ifPresent(builder::setEmulatorHost);
+ spannerConfiguration.emulatorHost().ifPresent(builder::setEmulatorHost);
return builder.build().getService();
}
}
diff --git a/storage/runtime/src/main/java/io/quarkiverse/googlecloudservices/storage/runtime/StorageConfiguration.java b/storage/runtime/src/main/java/io/quarkiverse/googlecloudservices/storage/runtime/StorageConfiguration.java
index 09255bbc..cf12394c 100644
--- a/storage/runtime/src/main/java/io/quarkiverse/googlecloudservices/storage/runtime/StorageConfiguration.java
+++ b/storage/runtime/src/main/java/io/quarkiverse/googlecloudservices/storage/runtime/StorageConfiguration.java
@@ -2,16 +2,16 @@
import java.util.Optional;
-import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;
+import io.smallrye.config.ConfigMapping;
-@ConfigRoot(name = "google.cloud.storage", phase = ConfigPhase.RUN_TIME)
-public class StorageConfiguration {
+@ConfigMapping(prefix = "quarkus.google.cloud.storage")
+@ConfigRoot(phase = ConfigPhase.RUN_TIME)
+public interface StorageConfiguration {
/**
* Overrides the default service host.
* This is most commonly used for development or testing activities with a local Google Cloud Storage emulator instance.
*/
- @ConfigItem
- public Optional hostOverride;
-}
\ No newline at end of file
+ Optional hostOverride();
+}
diff --git a/storage/runtime/src/main/java/io/quarkiverse/googlecloudservices/storage/runtime/StorageProducer.java b/storage/runtime/src/main/java/io/quarkiverse/googlecloudservices/storage/runtime/StorageProducer.java
index e078b651..e4fc1e57 100644
--- a/storage/runtime/src/main/java/io/quarkiverse/googlecloudservices/storage/runtime/StorageProducer.java
+++ b/storage/runtime/src/main/java/io/quarkiverse/googlecloudservices/storage/runtime/StorageProducer.java
@@ -35,7 +35,7 @@ public Storage storage() throws IOException {
StorageOptions.Builder builder = StorageOptions.newBuilder()
.setCredentials(googleCredentials)
.setProjectId(gcpConfiguration.projectId().orElse(null));
- storageConfiguration.hostOverride.ifPresent(builder::setHost);
+ storageConfiguration.hostOverride().ifPresent(builder::setHost);
return builder.build().getService();
}
}