/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package DataMapper;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.json.JSONObject;

/**
 *
 * @author Christian
 */
public class settingsInit {
    String text;
    public static String racetimerURL = "";
    static String racetimerUser = "";
    static String racetimerPassword = "";
    static String forumURL = "";
    static String forumUser = "";
    static String forumPassword = "";

    public settingsInit() {
        try {
            this.text = new String(Files.readAllBytes(Paths.get("/opt/tomcat/race_backend_settings.json")), StandardCharsets.UTF_8);
            JSONObject obj = new JSONObject(text);
            this.racetimerURL = obj.getString("racetimerURL");
            this.racetimerUser = obj.getString("racetimerUser");
            this.racetimerPassword = obj.getString("racetimerPassword");
            this.forumURL = obj.getString("forumURL");
            this.forumUser = obj.getString("forumUser");
            this.forumPassword = obj.getString("forumPassword");
        } catch (IOException ex) {
            Logger.getLogger(settingsInit.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
