From b3cd62bf488ac3b16281e628f9da86bfb164882a Mon Sep 17 00:00:00 2001 From: Roberto Cortez Date: Tue, 30 Jan 2024 17:47:52 +0000 Subject: [PATCH] Programmatically ignore unmapped properties --- .../config/SbomConfigBuilderCustomizer.java | 28 +++++++++++++++++++ ...rye.config.SmallRyeConfigBuilderCustomizer | 1 + service/src/main/resources/application.yaml | 4 --- 3 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 service/src/main/java/org/jboss/sbomer/service/feature/sbom/config/SbomConfigBuilderCustomizer.java create mode 100644 service/src/main/resources/META-INF/services/io.smallrye.config.SmallRyeConfigBuilderCustomizer diff --git a/service/src/main/java/org/jboss/sbomer/service/feature/sbom/config/SbomConfigBuilderCustomizer.java b/service/src/main/java/org/jboss/sbomer/service/feature/sbom/config/SbomConfigBuilderCustomizer.java new file mode 100644 index 000000000..79a6b933a --- /dev/null +++ b/service/src/main/java/org/jboss/sbomer/service/feature/sbom/config/SbomConfigBuilderCustomizer.java @@ -0,0 +1,28 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2023 Red Hat, Inc., and individual contributors + * as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jboss.sbomer.service.feature.sbom.config; + +import io.smallrye.config.SmallRyeConfigBuilder; +import io.smallrye.config.SmallRyeConfigBuilderCustomizer; + +public class SbomConfigBuilderCustomizer implements SmallRyeConfigBuilderCustomizer { + @Override + public void configBuilder(final SmallRyeConfigBuilder builder) { + builder.withMappingIgnore("sbomer.**"); + } +} diff --git a/service/src/main/resources/META-INF/services/io.smallrye.config.SmallRyeConfigBuilderCustomizer b/service/src/main/resources/META-INF/services/io.smallrye.config.SmallRyeConfigBuilderCustomizer new file mode 100644 index 000000000..fbfea7420 --- /dev/null +++ b/service/src/main/resources/META-INF/services/io.smallrye.config.SmallRyeConfigBuilderCustomizer @@ -0,0 +1 @@ +org.jboss.sbomer.service.feature.sbom.config.SbomConfigBuilderCustomizer diff --git a/service/src/main/resources/application.yaml b/service/src/main/resources/application.yaml index 9e14e79b2..443d0a651 100644 --- a/service/src/main/resources/application.yaml +++ b/service/src/main/resources/application.yaml @@ -41,10 +41,6 @@ quarkus: application: version: ${buildNumber} - config: - mapping: - validate-unknown: false - # Make the startup a bit nicer banner: path: banner.txt