ControllerConfig.hpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef CONTROLLER_CONFIG_HPP
  2. #define CONTROLLER_CONFIG_HPP
  3. #include "Redis.hpp"
  4. #include <string>
  5. namespace ZeroTier {
  6. struct PubSubConfig {
  7. std::string project;
  8. };
  9. struct PostgresNotifyConfig {
  10. std::string channel;
  11. };
  12. struct BigTableConfig {
  13. std::string project_id;
  14. std::string instance_id;
  15. std::string table_id;
  16. };
  17. struct ControllerConfig {
  18. bool ssoEnabled;
  19. std::string listenMode;
  20. std::string statusMode;
  21. RedisConfig* redisConfig;
  22. PubSubConfig* pubSubConfig;
  23. PostgresNotifyConfig* postgresNotifyConfig;
  24. BigTableConfig* bigTableConfig;
  25. ControllerConfig()
  26. : ssoEnabled(false)
  27. , listenMode("")
  28. , statusMode("")
  29. , redisConfig(nullptr)
  30. , pubSubConfig(nullptr)
  31. , postgresNotifyConfig(nullptr)
  32. , bigTableConfig(nullptr)
  33. {
  34. }
  35. ~ControllerConfig()
  36. {
  37. if (redisConfig) {
  38. delete redisConfig;
  39. redisConfig = nullptr;
  40. }
  41. if (pubSubConfig) {
  42. delete pubSubConfig;
  43. pubSubConfig = nullptr;
  44. }
  45. if (postgresNotifyConfig) {
  46. delete postgresNotifyConfig;
  47. postgresNotifyConfig = nullptr;
  48. }
  49. if (bigTableConfig) {
  50. delete bigTableConfig;
  51. bigTableConfig = nullptr;
  52. }
  53. }
  54. };
  55. } // namespace ZeroTier
  56. #endif // CONTROLLER_CONFIG_HPP