Skip to content

Commit 4ffb401

Browse files
LoRezthomasdarimont
authored andcommitted
Check if mkcert is installed in createTlsCerts.java and envcheck.java
1 parent 0068f57 commit 4ffb401

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

bin/createTlsCerts.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,18 @@ public static void main(String[] args) throws IOException, InterruptedException
106106
var pb = new ProcessBuilder(commandLine);
107107
pb.directory(new File(targetDir));
108108
pb.inheritIO();
109-
var process = pb.start();
110-
var mkCertCommandsReturnCode = process.waitFor();
109+
var mkCertCommandsReturnCode = 0;
110+
try {
111+
var processMkcert = pb.start();
112+
mkCertCommandsReturnCode = processMkcert.waitFor();
113+
if (mkCertCommandsReturnCode > 0) {
114+
System.out.println("Please install mkcert.");
115+
System.exit(mkCertCommandsReturnCode);
116+
}
117+
} catch (Exception e) {
118+
System.out.println("Please install mkcert.");
119+
System.exit(mkCertCommandsReturnCode);
120+
}
111121

112122
/* List created files */
113123
Files.list(Paths.get(targetDir)).filter(p -> FileSystems.getDefault().getPathMatcher(PEM_FILE_GLOB).matches(p)).forEach(System.out::println);

bin/envcheck.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,22 @@ public static void main(String[] args) throws IOException, InterruptedException
2929
System.out.println("Please install docker compose.");
3030
}
3131

32+
/* Check required tools: mkcert */
33+
System.out.print("mkcert: ");
34+
var pbMkcert = new ProcessBuilder(List.of("mkcert", "-version"));
35+
pbMkcert.inheritIO();
36+
try {
37+
pbMkcert.start();
38+
var processMkcert = pbMkcert.start();
39+
returnCode += processMkcert.waitFor();
40+
if (returnCode > 0) {
41+
System.out.println("Please install mkcert.");
42+
}
43+
} catch (Exception e) {
44+
System.out.println("Please install mkcert.");
45+
}
46+
47+
3248
/*Check directories exist */
3349
var requiredDirectories = List.of("./keycloak/extensions/target/classes",
3450
"./keycloak/imex","./keycloak/themes/apps",

0 commit comments

Comments
 (0)