Skip to content

Commit

Permalink
Trim container-image configuration values
Browse files Browse the repository at this point in the history
Fixes: quarkusio#19956
(cherry picked from commit ab8fa5e)
  • Loading branch information
geoand authored and gsmet committed Nov 30, 2021
1 parent 976c5ce commit 8797fe6
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigRoot;
import io.quarkus.runtime.annotations.ConvertWith;
import io.quarkus.runtime.configuration.TrimmedStringConverter;

@ConfigRoot
public class ContainerImageConfig {
Expand All @@ -13,12 +15,14 @@ public class ContainerImageConfig {
* The group the container image will be part of
*/
@ConfigItem(defaultValue = "${user.name}")
@ConvertWith(TrimmedStringConverter.class)
public Optional<String> group;

/**
* The name of the container image. If not set defaults to the application name
*/
@ConfigItem(defaultValue = "${quarkus.application.name:unset}")
@ConvertWith(TrimmedStringConverter.class)
public Optional<String> name;

/**
Expand Down Expand Up @@ -95,6 +99,9 @@ public Optional<String> getEffectiveGroup() {
if (group.isPresent()) {
String originalGroup = group.get();
if (originalGroup.equals(System.getProperty("user.name"))) {
if (originalGroup.isEmpty()) {
return Optional.empty();
}
return Optional.of(originalGroup.toLowerCase().replace(' ', '-'));
}
}
Expand Down

0 comments on commit 8797fe6

Please sign in to comment.