143 #define SERVER_WALLET_FILENAME "notaryServer.xml"
144 #define SERVER_MASTER_KEY_TIMEOUT_DEFAULT -1
145 #define SERVER_USE_SYSTEM_KEYRING false
152 const char* szFunc =
"ConfigLoader::load()";
155 OTString strConfigFolder, strConfigFilename;
169 if (!p_Config->Load()) {
171 0,
"%s: Note: Unable to Load Config. Creating a new file: %s\n",
172 szFunc, strConfigFilename.
Get());
173 if (!p_Config->
Reset())
return false;
174 if (!p_Config->Save())
return false;
177 if (!p_Config->
Reset())
return false;
180 if (!p_Config->Load()) {
181 OTLog::vError(0,
"%s: Error: Unable to load config file: %s It should "
182 "exist, as we just saved it!\n",
183 szFunc, strConfigFilename.
Get());
191 p_Config->
CheckSet_long(
"logging",
"log_level", 0, lValue, bIsNewKey);
205 walletFilename.
Set(strValue);
211 const char* szComment =
";; CRON (regular events like market trades "
212 "and smart contract clauses)\n";
219 const char* szComment =
"; refill_trans_number is the count of "
220 "transaction numbers cron will grab for "
222 "; whenever its supply is getting low. If it "
223 "ever drops below 20% of this count\n"
224 "; while in the middle of processing, it will "
225 "put a WARNING into your server log.\n";
229 p_Config->
CheckSet_long(
"cron",
"refill_trans_number", 500, lValue,
230 bIsNewKey, szComment);
235 const char* szComment =
"; ms_between_cron_beats is the number of "
236 "milliseconds before Cron processes\n"
237 "; (all the trades, all the smart contracts, "
238 "etc every 10 seconds.)\n";
242 p_Config->
CheckSet_long(
"cron",
"ms_between_cron_beats", 10000, lValue,
243 bIsNewKey, szComment);
248 const char* szComment =
"; max_items_per_nym is the number of cron "
249 "items (such as market offers or payment\n"
250 "; plans) that any given Nym is allowed to "
251 "have live and active at the same time.\n";
255 p_Config->
CheckSet_long(
"cron",
"max_items_per_nym", 10, lValue,
256 bIsNewKey, szComment);
263 const char* szComment =
";; HEARTBEAT\n";
270 const char* szComment =
"; no_requests is the number of client "
271 "requests the server processes per "
276 p_Config->
CheckSet_long(
"heartbeat",
"no_requests", 10, lValue,
277 bIsNewKey, szComment);
282 const char* szComment =
"; ms_between_beats is the number of "
283 "milliseconds between each heartbeat.\n";
287 p_Config->
CheckSet_long(
"heartbeat",
"ms_between_beats", 100, lValue,
288 bIsNewKey, szComment);
290 static_cast<int32_t>(lValue));
296 const char* szComment =
";; PERMISSIONS\n"
297 ";; You can deactivate server functions here "
298 "by setting them to false.\n"
299 ";; (Even if you do, override_nym_id will "
300 "STILL be able to do those functions.)\n";
311 szValue = stdstrValue.c_str();
315 if (
nullptr == szValue)
316 p_Config->
CheckSet_str(
"permissions",
"override_nym_id",
nullptr,
317 strValue, bIsNewKey);
319 p_Config->
CheckSet_str(
"permissions",
"override_nym_id", szValue,
320 strValue, bIsNewKey);
328 const char* szComment =
"; minimum_scale is the smallest allowed "
329 "power-of-ten for the scale, for any market.\n"
330 "; (1oz, 10oz, 100oz, 1000oz.)\n";
336 bIsNewKey, szComment);
344 const char* szComment =
345 "; master_key_timeout is how int64_t the master key will be in "
346 "memory until a thread wipes it out.\n"
347 "; 0 : means you have to type your password EVERY time OT uses a "
348 "private key. (Even multiple times in a single function.)\n"
349 "; 300 : means you only have to type it once per 5 minutes.\n"
350 "; -1 : means you only type it once PER RUN (popular for "
357 bIsNewKey, szComment);
369 #if defined(OT_KEYRING_FLATFILE)
379 OTKeyring::FlatFile_SetPasswordFolder(strValue.
Get());
432 p_Config->
SetOption_bool(
"permissions",
"transact_exchange_basket",
434 p_Config->
SetOption_bool(
"permissions",
"cmd_notarize_transaction",
444 p_Config->
SetOption_bool(
"permissions",
"transact_withdraw_voucher",
448 p_Config->
SetOption_bool(
"permissions",
"transact_deposit_cheque",
460 p_Config->
SetOption_bool(
"permissions",
"cmd_get_market_recent_trades",
462 p_Config->
SetOption_bool(
"permissions",
"cmd_get_nym_market_offers",
468 p_Config->
SetOption_bool(
"permissions",
"transact_cancel_cron_item",
470 p_Config->
SetOption_bool(
"permissions",
"transact_smart_contract",
476 if (!p_Config->Save()) {
477 OTLog::vError(
"%s: Error! Unable to save updated Config!!!\n", szFunc);
482 if (!p_Config->
Reset())
return false;
484 if (
nullptr != p_Config)
delete p_Config;
static EXPORT void vError(const char *szError,...)
static void SetCronRefillAmount(int32_t nAmount)
static bool __cmd_check_user
static bool __admin_usage_credits
static void SetHeartbeatNoRequests(int32_t value)
static bool __transact_withdraw_cash
static EXPORT bool GetConfigFilePath(OTString &strConfigFilePath)
static bool __cmd_create_asset_acct
static const std::string & GetOverrideNymID()
static bool __cmd_get_market_list
static bool __cmd_get_outbox
static EXPORT bool SetLogLevel(const int32_t &nLogLevel)
static bool __cmd_issue_basket
static void SetCronMaxItemsPerNym(int32_t nMax)
static bool __transact_market_offer
static bool __transact_withdrawal
static bool __transact_cancel_cron_item
static EXPORT bool IsInitialized()
EXPORT bool Exists() const
static EXPORT std::shared_ptr< OTCachedKey > It(OTIdentifier *pIdentifier=nullptr)
static bool load(OTString &walletFilename)
static bool __cmd_get_acct
static bool __cmd_check_server_id
static bool __cmd_get_inbox
static void SetHeartbeatMsBetweenBeats(int32_t value)
EXPORT void Set(const char *data, uint32_t enforcedMaxLength=0)
static bool __transact_transfer
static bool __cmd_process_nymbox
static int64_t GetMinMarketScale()
static bool __transact_deposit
static bool __transact_smart_contract
static bool __cmd_del_asset_acct
static void SetCronMsBetweenProcess(int32_t lMS)
static bool __transact_process_inbox
static bool __cmd_get_nym_market_offers
#define SERVER_USE_SYSTEM_KEYRING
static bool __transact_exchange_basket
EXPORT bool CheckSet_str(const OTString &strSection, const OTString &strKey, const OTString &strDefault, OTString &out_strResult, bool &out_bIsNew, const OTString &strComment="")
static bool __cmd_process_inbox
static bool __cmd_del_user_acct
static bool __cmd_get_request
EXPORT const char * Get() const
static bool __transact_withdraw_voucher
EXPORT bool SetOption_bool(const OTString &strSection, const OTString &strKey, bool &bVariableName)
static bool __cmd_get_mint
static void SetMinMarketScale(int64_t value)
EXPORT bool CheckSet_long(const OTString &strSection, const OTString &strKey, const int64_t &lDefault, int64_t &out_lResult, bool &out_bIsNew, const OTString &strComment="")
static bool __transact_deposit_cash
#define SERVER_WALLET_FILENAME
static bool __cmd_create_user_acct
static bool __transact_deposit_cheque
static bool __admin_server_locked
EXPORT bool CheckSetSection(const OTString &strSection, const OTString &strComment, bool &out_bIsNewSection)
static bool __transact_payment_plan
static bool __cmd_get_contract
static bool __cmd_issue_asset
#define SERVER_MASTER_KEY_TIMEOUT_DEFAULT
static void SetOverrideNymID(const std::string &id)
static bool __cmd_get_nymbox
#define SERVER_PASSWORD_FOLDER
static bool __cmd_get_market_offers
static bool __transact_pay_dividend
static bool __cmd_notarize_transaction
static bool __cmd_get_trans_num
static EXPORT void vOutput(int32_t nVerbosity, const char *szOutput,...)
static bool __cmd_trigger_clause
static bool __cmd_usage_credits
EXPORT bool CheckSet_bool(const OTString &strSection, const OTString &strKey, const bool &bDefault, bool &out_bResult, bool &out_bIsNew, const OTString &strComment="")
static bool __cmd_send_message
static bool __cmd_get_market_recent_trades