diff --git a/CHANGELOG.md b/CHANGELOG.md index 784de18a2..47fb50150 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # v4.0.2-beta - [#1183](https://github.com/xmrig/xmrig/issues/1183) Fixed compatibility with systemd. - [#1185](https://github.com/xmrig/xmrig/pull/1185) Added JIT compiler for RandomX on ARMv8. +- Command line option `--http-enabled` removed, HTTP API enabled automatically if any other `--http-*` option provided. # v4.0.1-beta - [#1177](https://github.com/xmrig/xmrig/issues/1177) Fixed compatibility with old AMD drivers. diff --git a/src/base/kernel/config/BaseTransform.cpp b/src/base/kernel/config/BaseTransform.cpp index a10960a4c..bd43036c4 100644 --- a/src/base/kernel/config/BaseTransform.cpp +++ b/src/base/kernel/config/BaseTransform.cpp @@ -102,6 +102,10 @@ void xmrig::BaseTransform::finalize(rapidjson::Document &doc) } } } + + if (m_http) { + set(doc, kHttp, "enabled", true); + } } @@ -164,9 +168,11 @@ void xmrig::BaseTransform::transform(rapidjson::Document &doc, int key, const ch return set(doc, "log-file", arg); case IConfig::HttpAccessTokenKey: /* --http-access-token */ + m_http = true; return set(doc, kHttp, "access-token", arg); case IConfig::HttpHostKey: /* --http-host */ + m_http = true; return set(doc, kHttp, "host", arg); case IConfig::ApiWorkerIdKey: /* --api-worker-id */ @@ -235,10 +241,12 @@ void xmrig::BaseTransform::transformBoolean(rapidjson::Document &doc, int key, b return set(doc, "colors", enable); case IConfig::HttpRestrictedKey: /* --http-no-restricted */ + m_http = true; return set(doc, kHttp, "restricted", enable); case IConfig::HttpEnabledKey: /* --http-enabled */ - return set(doc, kHttp, "enabled", enable); + m_http = true; + break; case IConfig::DryRunKey: /* --dry-run */ return set(doc, "dry-run", enable); @@ -265,6 +273,7 @@ void xmrig::BaseTransform::transformUint64(rapidjson::Document &doc, int key, ui return set(doc, "donate-over-proxy", arg); case IConfig::HttpPort: /* --http-port */ + m_http = true; return set(doc, kHttp, "port", arg); case IConfig::PrintTimeKey: /* --print-time */ diff --git a/src/base/kernel/config/BaseTransform.h b/src/base/kernel/config/BaseTransform.h index 5fa0c8c59..f926861de 100644 --- a/src/base/kernel/config/BaseTransform.h +++ b/src/base/kernel/config/BaseTransform.h @@ -102,6 +102,8 @@ protected: private: void transformBoolean(rapidjson::Document &doc, int key, bool enable); void transformUint64(rapidjson::Document &doc, int key, uint64_t arg); + + bool m_http = false; }; diff --git a/src/core/config/usage.h b/src/core/config/usage.h index 34998bce6..615921b36 100644 --- a/src/core/config/usage.h +++ b/src/core/config/usage.h @@ -87,7 +87,6 @@ static inline const std::string &usage() u += "\nAPI:\n"; u += " --api-worker-id=ID custom worker-id for API\n"; u += " --api-id=ID custom instance ID for API\n"; - u += " --http-enabled enable HTTP API\n"; u += " --http-host=HOST bind host for HTTP API (default: 127.0.0.1)\n"; u += " --http-port=N bind port for HTTP API\n"; u += " --http-access-token=T access token for HTTP API\n";