From 822eaf18ac54a791ea2af4313ec621ddcd8e32dd Mon Sep 17 00:00:00 2001 From: elroy Date: Mon, 10 Jul 2017 22:35:47 +0200 Subject: [PATCH] Add gunbot location to check setup page --- .../gpi/controllers/CheckSetupController.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main/java/nl/komtek/gpi/controllers/CheckSetupController.java b/src/main/java/nl/komtek/gpi/controllers/CheckSetupController.java index af3d8ba..50d3beb 100644 --- a/src/main/java/nl/komtek/gpi/controllers/CheckSetupController.java +++ b/src/main/java/nl/komtek/gpi/controllers/CheckSetupController.java @@ -9,6 +9,7 @@ import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; +import java.io.File; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.HashMap; @@ -87,6 +88,22 @@ public class CheckSetupController { setupData.put("www.poloniex.com", e.getMessage()); } + String gunbotLocation = util.getEnvProperty("gunbot.location"); + if (!StringUtils.isEmpty(gunbotLocation.length())) { + if (!gunbotLocation.startsWith("file://")) { + setupData.put("Gunbot location", "Your file location should start with 'file://'"); + } else { + File file = new File(gunbotLocation); + if (file.exists()) { + setupData.put("Gunbot location", "Looking good!"); + } else { + setupData.put("Gunbot location", "The specified location does not exist"); + } + } + } else { + setupData.put("Gunbot location", "You cannot use monitoring without this"); + } + modelMap.put("setupData", setupData); return new ModelAndView("setupData", modelMap); }