This commit is contained in:
2020-10-18 20:48:23 +02:00
parent 16d5baabef
commit 93cbcb75a4

View File

@@ -31,25 +31,25 @@ public class GistProvider {
private String password;
private GistProvider() {
this.gistList = listAllGists();
readConfig();
this.gistList = listAllGists();
}
private void readConfig() {
JSONParser jsonParser = new JSONParser();
URL url = Resources.getResource("Gist_Config.json");
JSONObject gistConfig;
JSONObject gistConfig = null;
try {
String jsonConfig = Resources.toString(url, StandardCharsets.UTF_8);
//Read JSON file
gistConfig = (JSONObject) jsonParser.parse(jsonConfig);
this.username = gistConfig.get("username").toString();
this.password = gistConfig.get("password").toString();
} catch (IOException | ParseException e) {
e.printStackTrace();
}
this.username = gistConfig.get("username").toString();
this.password = gistConfig.get("password").toString();
}
public static GistProvider getInstance() {