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

fix(#64) Check if mkcert is installed in createTlsCerts.java and envcheck.java #65

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
14 changes: 12 additions & 2 deletions bin/createTlsCerts.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,18 @@ public static void main(String[] args) throws IOException, InterruptedException
var pb = new ProcessBuilder(commandLine);
pb.directory(new File(targetDir));
pb.inheritIO();
var process = pb.start();
var mkCertCommandsReturnCode = process.waitFor();
var mkCertCommandsReturnCode = 0;
try {
var processMkcert = pb.start();
mkCertCommandsReturnCode = processMkcert.waitFor();
if (mkCertCommandsReturnCode > 0) {
System.out.println("Please install mkcert.");
System.exit(mkCertCommandsReturnCode);
}
} catch (Exception e) {
System.out.println("Please install mkcert.");
System.exit(mkCertCommandsReturnCode);
}

/* List created files */
Files.list(Paths.get(targetDir)).filter(p -> FileSystems.getDefault().getPathMatcher(PEM_FILE_GLOB).matches(p)).forEach(System.out::println);
Expand Down
16 changes: 16 additions & 0 deletions bin/envcheck.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@ public static void main(String[] args) throws IOException, InterruptedException
System.out.println("Please install docker compose.");
}

/* Check required tools: mkcert */
System.out.print("mkcert: ");
var pbMkcert = new ProcessBuilder(List.of("mkcert", "-version"));
pbMkcert.inheritIO();
try {
pbMkcert.start();
var processMkcert = pbMkcert.start();
returnCode += processMkcert.waitFor();
if (returnCode > 0) {
System.out.println("Please install mkcert.");
}
} catch (Exception e) {
System.out.println("Please install mkcert.");
}


/*Check directories exist */
var requiredDirectories = List.of("./keycloak/extensions/target/classes",
"./keycloak/imex","./keycloak/themes/apps",
Expand Down