Start implementing yaml loading
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
66d27fe1fe
commit
e396ce6417
@ -11,7 +11,7 @@ import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
public class Configuration
|
||||
public class Cache
|
||||
{
|
||||
|
||||
|
@ -0,0 +1,40 @@
|
||||
package wtf.beatrice.hidekobot.utils;
|
||||
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
|
||||
public class ConfigurationUtil
|
||||
{
|
||||
private final String configFilePath;
|
||||
|
||||
public ConfigurationUtil(String configFilePath)
|
||||
{
|
||||
this.configFilePath = configFilePath;
|
||||
}
|
||||
|
||||
public void initConfig()
|
||||
{
|
||||
Yaml internalConfigYaml = new Yaml();
|
||||
Map<String, Object> internalConfigContents = null;
|
||||
|
||||
try (InputStream internalConfigStream = getClass()
|
||||
.getClassLoader()
|
||||
.getResourceAsStream("config.yml"))
|
||||
{
|
||||
internalConfigContents = internalConfigYaml.load(internalConfigStream);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if(internalConfigContents == null) // todo error handling
|
||||
{
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user