SecondBot/SecondBotEvents/Config/http_config.cs
Madpeter b16d17f228 wip
2022-03-16 18:36:30 +00:00

38 lines
No EOL
935 B
C#

using System;
using System.Collections.Generic;
using System.Text;
namespace SecondBotEvents.Config
{
public class http_config: config
{
public http_config(bool fromENV, string fromFolder = "") : base(fromENV, fromFolder) { }
protected override void makeSettings()
{
filename = "http";
settings.Add("enabled");
settings.Add("port");
}
public int getPort()
{
bool result = int.TryParse(readSetting("port", "8080"), out int port);
if(result == false)
{
return 8080;
}
return port;
}
public bool getEnabled()
{
bool result = bool.TryParse(readSetting("enabled", "false"), out bool enabled);
if (result == false)
{
return false;
}
return enabled;
}
}
}