Skip to content

Commit b788323

Browse files
committed
fix null default values
1 parent a739a4b commit b788323

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

github-app-installation/src/main/java/com/walmartlabs/concord/github/appinstallation/cfg/GitHubAppInstallationConfig.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ static OauthConfig from(com.typesafe.config.Config cfg) {
119119
return new OauthConfig(
120120
getStringOrDefault(cfg, "id", () -> "github-oauth-token"),
121121
cfg.getString("urlPattern"),
122-
getStringOrDefault(cfg, "username", null),
122+
getStringOrDefault(cfg, "username", () -> null),
123123
cfg.getString("token")
124124
);
125125
}
@@ -139,11 +139,11 @@ record AppInstallationConfig(String id, String urlPattern, String username, Stri
139139

140140
static AppInstallationConfig from(com.typesafe.config.Config cfg) {
141141

142-
var username = Optional.ofNullable(getStringOrDefault(cfg, "apiUrl", null))
142+
var username = Optional.ofNullable(getStringOrDefault(cfg, "username", () -> null))
143143
.filter(s -> !s.isBlank())
144144
.orElse("x-access-token");
145145

146-
var apiUrl = Optional.ofNullable(getStringOrDefault(cfg, "apiUrl", null))
146+
var apiUrl = Optional.ofNullable(getStringOrDefault(cfg, "apiUrl", () -> null))
147147
.filter(s -> !s.isBlank())
148148
.orElse("https://api.github.com");
149149

server/dist/src/main/resources/concord-server.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ concord-server {
527527
# Importantly, urlPattern must include a regex capture group named 'baseUrl'.
528528
# This is necessary to detect where the owner/repo values begin in the path.
529529
# {
530+
# id = "my-gh-app", # identifier for the config, e.g. for metrics
530531
# type = "GITHUB_APP_INSTALLATION",
531532
# urlPattern = "(?<baseUrl>github.com)", # regex
532533
# username = "...", # optional, defaults to "x-access-token"
@@ -537,10 +538,12 @@ concord-server {
537538
# or static oauth config. Not exactly a "GitHub App", but can do some
538539
# API interactions and cloning. Actual app installation is preferred.
539540
# {
541+
# id = "my-static-token", # identifier for the config, e.g. for metrics
540542
# type = "OAUTH_TOKEN",
541543
# token = "...",
542544
# username = "...", # optional, usually not necessary
543545
# urlPattern = "..." # regex to match against git server's hostname + port + path
546+
# apiUrl = "https://api.github.com", # github API url, usually *not* the same as the repo url host/path
544547
# }
545548
auth = []
546549

0 commit comments

Comments
 (0)