Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webhook 을 호출하는 serverUri 부분 다른 resolve 와 동일하게 config 를 가져오도록 수정 #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,20 @@ public class HTTPEventConfiguration {

public static HTTPEventConfiguration createFromScope(Scope config) {
HTTPEventConfiguration configuration = new HTTPEventConfiguration();

configuration.serverUri = resolveConfigVar("serverUri");

String serverUri = resolveConfigVar(config, "serverUri", "http://127.0.0.1:8080/webhook");

configuration.serverUri = toSet(serverUri, ",");
configuration.username = resolveConfigVar(config, "username", "keycloak");
configuration.password = resolveConfigVar(config, "password", "keycloak");

return configuration;

}

private static Set<String> resolveConfigVar(String variableName) {
String envVariables = System.getenv(PREFIX_CONFIGURATION + variableName.toUpperCase());
if (envVariables != null) {
return Arrays.stream(envVariables.split(","))
.collect(Collectors.toSet());
}
return Collections.emptySet();
private static Set<String> toSet(String envVariables, String regex) {
return Arrays.stream(envVariables.split(regex))
.collect(Collectors.toSet());
}

private static String resolveConfigVar(Scope config, String variableName, String defaultValue) {
Expand Down