Something something run it on windows
This commit is contained in:
parent
437512b0b9
commit
1ce1781f40
3
Makefile
3
Makefile
@ -9,4 +9,5 @@ docker:
|
||||
docker build -t ${BUILD} .
|
||||
docker tag ${BUILD} ${LATEST}
|
||||
docker push ${BUILD}
|
||||
docker push ${LATEST}
|
||||
docker push ${LATEST}
|
||||
|
||||
|
@ -17,14 +17,14 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
|
||||
@SpringBootApplication
|
||||
public class Main {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(Main.class);
|
||||
|
||||
public static void main(String[] args) {
|
||||
String configLocation = Constants.BOT_FOLDER.concat(Constants.CONFIG_NAME);
|
||||
BotConfig.initConfig(configLocation, false);
|
||||
BotConfig.initConfig(Constants.BOT_FOLDER, false);
|
||||
|
||||
FSDB.init();
|
||||
|
||||
|
@ -8,8 +8,11 @@ package dev.salmonllama.fsbot.config;
|
||||
|
||||
import com.kaaz.configuration.ConfigurationBuilder;
|
||||
import com.kaaz.configuration.ConfigurationOption;
|
||||
import dev.salmonllama.fsbot.utilities.Constants;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
public class BotConfig {
|
||||
@ConfigurationOption
|
||||
@ -78,9 +81,9 @@ public class BotConfig {
|
||||
@ConfigurationOption
|
||||
public static String HOME_SERVER = "Home server here";
|
||||
|
||||
public static void initConfig(String filePath, boolean cleanfile) {
|
||||
public static void initConfig(Path filePath, boolean cleanfile) {
|
||||
try {
|
||||
new ConfigurationBuilder(BotConfig.class, new File(filePath)).build(cleanfile);
|
||||
new ConfigurationBuilder(BotConfig.class, Paths.get(filePath.toString(), Constants.CONFIG_NAME) .toFile()).build(cleanfile);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
|
@ -20,7 +20,7 @@ public class DatabaseProvider {
|
||||
|
||||
public DatabaseProvider(String dbName) {
|
||||
DB_NAME = dbName;
|
||||
DB_ADDR = "jdbc:sqlite:".concat(Constants.BOT_FOLDER).concat(BotConfig.DB_ADDR);
|
||||
DB_ADDR = "jdbc:sqlite:".concat(Constants.BOT_FOLDER.toString()).concat(BotConfig.DB_ADDR);
|
||||
}
|
||||
|
||||
private Connection createConnection() {
|
||||
|
@ -5,11 +5,14 @@
|
||||
|
||||
package dev.salmonllama.fsbot.utilities;
|
||||
|
||||
public class Constants {
|
||||
public static final String BOT_FOLDER = System.getenv("HOME").concat("/.fsbot/");
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
public class Constants {
|
||||
public static final String CONFIG_NAME = "bot.config";
|
||||
|
||||
public static final Path BOT_FOLDER = Paths.get(System.getProperty("user.home"), ".fsbot");
|
||||
|
||||
public static final String DB_NAME = "fsbot";
|
||||
|
||||
public static final String OUTFIT_TABLE = "outfits";
|
||||
|
Loading…
Reference in New Issue
Block a user