Add gunbot location to check setup page

This commit is contained in:
elroy 2017-07-10 22:35:47 +02:00
parent 4f75026fc3
commit 822eaf18ac
1 changed files with 17 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import java.io.File;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.util.HashMap; import java.util.HashMap;
@ -87,6 +88,22 @@ public class CheckSetupController {
setupData.put("www.poloniex.com", e.getMessage()); 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); modelMap.put("setupData", setupData);
return new ModelAndView("setupData", modelMap); return new ModelAndView("setupData", modelMap);
} }