| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #pragma once
- #include <string>
- #include <memory>
- #include <json/json.h>
- #define CFGPATH "cfg.json"
- class CConfig
- {
- public:
- ~CConfig();
- bool load();
- // freeswitch属性
- std::string fsIp() const { return m_fsIp; }
- std::int16_t fsPort() const { return m_fsPort; }
- std::string fsPwd() const { return m_fsPwd; }
- // websocket属性
- std::int16_t wsPort()const { return m_wsPort; }
- std::int16_t wssPort()const { return m_wssPort; }
- std::string sslFile()const { return m_sslFilePath; }
- std::string sslPwd()const { return m_sslPwd; }
- // 数据库属性
- std::string dbHost()const { return m_DBhost; }
- std::string dbUser()const { return m_DBusername; }
- std::string dbPwd()const { return m_DBpasswd; }
- std::string dbName()const { return m_DBdatabase; }
- static std::shared_ptr<CConfig> GetInstance() { return pInstance; }
- private:
- CConfig();
- CConfig(const CConfig&) = default;
- CConfig& operator=(const CConfig&) = default;
- bool write();
- private:
- // FreeSWITCH 连接信息
- std::string m_fsIp; // freeSwitch ip
- std::int16_t m_fsPort; // freeswitch 端口
- std::string m_fsPwd; // freeswitch 密码
-
- // websocket 信息
- std::int16_t m_wsPort; // websocket ws端口
- std::int16_t m_wssPort; // websocket wss端口
- std::string m_sslFilePath; // ssl 证书
- std::string m_sslPwd; // SSL 证书密码
- // 数据库信息
- std::string m_DBhost;
- std::string m_DBusername;
- std::string m_DBpasswd;
- std::string m_DBdatabase;
- Json::Value root;
- static std::shared_ptr<CConfig> pInstance;
- };
|