diff --git a/.github/workflows/xahau-ga-nix.yml b/.github/workflows/xahau-ga-nix.yml index d473630a0..a2636bbb8 100644 --- a/.github/workflows/xahau-ga-nix.yml +++ b/.github/workflows/xahau-ga-nix.yml @@ -464,3 +464,16 @@ jobs: verbose: true plugins: noop use_oidc: true + + - name: Export server definitions + if: matrix.job_type == 'build' && matrix.compiler_id == 'gcc-13-libstdcxx' + run: | + ${{ env.build_dir }}/rippled --definitions | python3 -m json.tool > server_definitions.json + + - name: Upload server definitions + if: matrix.job_type == 'build' && matrix.compiler_id == 'gcc-13-libstdcxx' + uses: actions/upload-artifact@v7 + with: + name: server-definitions + path: server_definitions.json + archive: false diff --git a/src/xrpld/app/main/Main.cpp b/src/xrpld/app/main/Main.cpp index f662e282f..65cfe65cf 100644 --- a/src/xrpld/app/main/Main.cpp +++ b/src/xrpld/app/main/Main.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -387,7 +388,8 @@ run(int argc, char** argv) po::value(), "Specify the range of present ledgers for testing purposes. Min and " "max values are comma separated.")( - "version", "Display the build version."); + "version", "Display the build version.")( + "definitions", "Output server definitions as JSON and exit."); po::options_description data("Ledger/Data Options"); data.add_options()("import", importText.c_str())( @@ -529,6 +531,13 @@ run(int argc, char** argv) return 0; } + if (vm.count("definitions")) + { + auto defs = getStaticServerDefinitions(); + std::cout << to_string(defs); + return 0; + } + #ifndef ENABLE_TESTS if (vm.count("unittest") || vm.count("unittest-child")) { diff --git a/src/xrpld/rpc/handlers/Handlers.h b/src/xrpld/rpc/handlers/Handlers.h index 83f9d2781..88711a182 100644 --- a/src/xrpld/rpc/handlers/Handlers.h +++ b/src/xrpld/rpc/handlers/Handlers.h @@ -133,6 +133,8 @@ doRipplePathFind(RPC::JsonContext&); Json::Value doServerDefinitions(RPC::JsonContext&); Json::Value +getStaticServerDefinitions(); +Json::Value doServerInfo(RPC::JsonContext&); // for humans Json::Value doServerState(RPC::JsonContext&); // for machines diff --git a/src/xrpld/rpc/handlers/ServerDefinitions.cpp b/src/xrpld/rpc/handlers/ServerDefinitions.cpp index 2d3ce7372..fe35e3755 100644 --- a/src/xrpld/rpc/handlers/ServerDefinitions.cpp +++ b/src/xrpld/rpc/handlers/ServerDefinitions.cpp @@ -525,6 +525,15 @@ public: } }; +Json::Value +getStaticServerDefinitions() +{ + static const Definitions defs{}; + Json::Value ret = defs(); + ret[jss::hash] = to_string(defs.getHash()); + return ret; +} + Json::Value doServerDefinitions(RPC::JsonContext& context) {