Skip to content

Commit

Permalink
Merge pull request #45550 from mcruzdev/config-gcp-functions
Browse files Browse the repository at this point in the history
Convert google-cloud-functions to use @ConfigMapping
  • Loading branch information
gsmet authored Jan 13, 2025
2 parents 86ff381 + cb356f7 commit 18c4016
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 12 deletions.
3 changes: 0 additions & 3 deletions extensions/google-cloud-functions/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@
<version>${project.version}</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
<arg>-AlegacyConfigRoot=true</arg>
</compilerArgs>
</configuration>
</execution>
</executions>
Expand Down
3 changes: 0 additions & 3 deletions extensions/google-cloud-functions/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@
<version>${project.version}</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
<arg>-AlegacyConfigRoot=true</arg>
</compilerArgs>
</configuration>
</execution>
</executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ public class GoogleCloudFunctionRecorder {
public void selectDelegate(GoogleCloudFunctionsConfig config, List<GoogleCloudFunctionInfo> cloudFunctions) {
Map<GoogleCloudFunctionInfo.FunctionType, String> delegates = new HashMap<>();
// if a function name is defined, check that it exists
if (config.function.isPresent()) {
String functionName = config.function.get();
if (config.function().isPresent()) {
String functionName = config.function().get();
boolean found = false;
for (GoogleCloudFunctionInfo info : cloudFunctions) {
if (functionName.equals(info.getBeanName())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

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(phase = ConfigPhase.RUN_TIME)
public class GoogleCloudFunctionsConfig {
@ConfigMapping(prefix = "quarkus.google-cloud-functions")
public interface GoogleCloudFunctionsConfig {
/**
* The function name. Function names are specified on function classes using the {@link @jakarta.inject.Named} annotation.
*
* If this name is unspecified and there is exactly one unnamed function then this unnamed function will be used.
* If there is only a single named function and the name is unspecified then the named function will be used.
* These rules apply for each function implementation (HttpFunction, BackgroundFunction, RawBackgroundFunction).
*/
@ConfigItem
public Optional<String> function;
Optional<String> function();
}

0 comments on commit 18c4016

Please sign in to comment.