246 * @return
247 */
248 Path scratchFolder() {
249 if (!config.contains("scratch") || !config.get("scratch").contains("path")) {
250 try {
251 log.warning("No scratch folder defined, creating a temporary folder");
252 return Files.createTempDirectory("botrunner");
253 } catch (IOException e) {
254 throw new UncheckedIOException(e);
255 }
256 }
257 return Paths.get(config.get("scratch").get("path").asString());
258 }
259
260 Optional<Integer> restReceiverPort() {
261 if (!config.contains("webhooks")) {
262 return Optional.empty();
263 }
264 return Optional.of(config.get("webhooks").get("port").asInt());
265 }
266 }
|
246 * @return
247 */
248 Path scratchFolder() {
249 if (!config.contains("scratch") || !config.get("scratch").contains("path")) {
250 try {
251 log.warning("No scratch folder defined, creating a temporary folder");
252 return Files.createTempDirectory("botrunner");
253 } catch (IOException e) {
254 throw new UncheckedIOException(e);
255 }
256 }
257 return Paths.get(config.get("scratch").get("path").asString());
258 }
259
260 Optional<Integer> restReceiverPort() {
261 if (!config.contains("webhooks")) {
262 return Optional.empty();
263 }
264 return Optional.of(config.get("webhooks").get("port").asInt());
265 }
266
267 Duration watchdogTimeout() {
268 if (!config.contains("runner") || !config.get("runner").contains("watchdog")) {
269 log.info("No WorkItem watchdog timeout defined, using default value");
270 return Duration.ofHours(1);
271 } else {
272 return Duration.parse(config.get("runner").get("watchdog").asString());
273 }
274 }
275 }
|