TimescaleConfig.cs 688 B

12345678910111213141516171819202122232425
  1. namespace OhmGraphite
  2. {
  3. public class TimescaleConfig
  4. {
  5. public bool SetupTable { get; }
  6. public string Connection { get; }
  7. public TimescaleConfig(string connection, bool setupTable)
  8. {
  9. SetupTable = setupTable;
  10. Connection = connection;
  11. }
  12. internal static TimescaleConfig ParseAppSettings(IAppConfig config)
  13. {
  14. string connection = config["timescale_connection"];
  15. if (!bool.TryParse(config["timescale_setup"], out bool setupTable))
  16. {
  17. setupTable = false;
  18. }
  19. return new TimescaleConfig(connection, setupTable);
  20. }
  21. }
  22. }