@@ -19,32 +19,41 @@ using namespace std;
1919namespace TIGER_API {
2020 class OPENAPI_EXPORT ClientConfig {
2121 public:
22- ClientConfig (bool sandbox_debug = false ) : sandbox_debug(sandbox_debug) {
22+ explicit ClientConfig (bool sandbox_debug = false ) :
23+ sandbox_debug(sandbox_debug) {
2324 if (sandbox_debug) {
2425 LOG (WARNING) << U (" SANDBOX IS NOT SUPPORTED" ) << endl;
2526 // server_url = SANDBOX_TIGER_SERVER_URL;
2627 // server_public_key = SANDBOX_TIGER_PUBLIC_KEY;
2728 }
2829 };
2930
30- ClientConfig (utility::string_t tiger_id, utility::string_t private_key, utility::string_t account) : tiger_id(std::move(tiger_id)),
31- private_key (std::move(
32- private_key)),
33- account(std::move(account)) {};
31+ // ClientConfig() : sandbox_debug(false) {};
32+
33+ ClientConfig (utility::string_t tiger_id, utility::string_t private_key, utility::string_t account) :
34+ tiger_id (std::move(tiger_id)),
35+ private_key (std::move(private_key)),
36+ account (std::move(account)) {};
3437
3538 ClientConfig (utility::string_t tiger_id, utility::string_t private_key, utility::string_t account,
36- bool sandbox_debug = false , utility::string_t lang = U(" en_US" )) :
37- tiger_id(std::move(tiger_id)), private_key(std::move(private_key)),
38- account(std::move(account)), sandbox_debug(sandbox_debug), lang(lang) {
39+ bool sandbox_debug = false , utility::string_t lang = U(" en_US" )) :
40+ tiger_id (std::move(tiger_id)),
41+ private_key (std::move(private_key)),
42+ account (std::move(account)),
43+ sandbox_debug (sandbox_debug),
44+ lang (lang) {
3945 if (sandbox_debug) {
40- server_url = SANDBOX_TIGER_SERVER_URL;
41- server_public_key = SANDBOX_TIGER_PUBLIC_KEY;
42- socket_url = SANDBOX_TIGER_SOCKET_HOST;
43- socket_port = SANDBOX_TIGER_SOCKET_PORT;
46+ LOG (WARNING) << U (" SANDBOX IS NOT SUPPORTED" ) << endl;
47+ // server_url = SANDBOX_TIGER_SERVER_URL;
48+ // server_public_key = SANDBOX_TIGER_PUBLIC_KEY;
49+ // socket_url = SANDBOX_TIGER_SOCKET_HOST;
50+ // socket_port = SANDBOX_TIGER_SOCKET_PORT;
4451 }
4552 };
4653
47- ClientConfig (utility::string_t props_path) : props_path(props_path) {
54+ explicit ClientConfig (bool sandbox_debug, const utility::string_t props_path) :
55+ sandbox_debug(sandbox_debug),
56+ props_path(props_path) {
4857 load_props ();
4958 };
5059
@@ -124,6 +133,7 @@ namespace TIGER_API {
124133 if (full_path.empty ()) {
125134 return ;
126135 }
136+ LOG (INFO) << U (" Loading properties file from: " ) << full_path << endl;
127137
128138 try {
129139 std::ifstream file (Utils::str16to8 (full_path));
@@ -135,13 +145,12 @@ namespace TIGER_API {
135145 Properties props;
136146 props.load (file);
137147
138- // 只在值为空时从配置文件加载
139148 if (tiger_id.empty ()) {
140149 tiger_id = props.get_property (U (" tiger_id" ));
141150 }
142151 if (private_key.empty ()) {
143152 private_key = props.get_property (U (" private_key_pk1" ));
144- }
153+ }
145154 if (account.empty ()) {
146155 account = props.get_property (U (" account" ));
147156 }
@@ -162,6 +171,7 @@ namespace TIGER_API {
162171 } catch (const std::exception& e) {
163172 LOG (ERROR) << U (" Failed to load properties file: " ) << Utils::str8to16 (e.what ()) << endl;
164173 }
174+ LOG (INFO) << U (" Loaded properties file successfully, tiger_id: " ) << tiger_id << " account: " << account << endl;
165175 }
166176
167177 utility::string_t get_props_path (const utility::string_t & filename) const {
@@ -173,7 +183,6 @@ namespace TIGER_API {
173183 return Utils::path_join (dirname, filename);
174184 }
175185 }
176- return utility::string_t ();
177186 }
178187
179188 utility::string_t get_token_path () const {
@@ -193,7 +202,7 @@ namespace TIGER_API {
193202 Properties props;
194203 props.load (file);
195204
196- // 获取token值
205+ // get token value
197206 token = props.get_property (U (" token" ));
198207
199208 } catch (const std::exception& e) {
0 commit comments