Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/reusable-build-test-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,20 @@ jobs:
retention-days: 3
if-no-files-found: error

- name: Export server definitions
if: ${{ github.event.repository.visibility == 'public' && inputs.config_name == 'debian-bookworm-gcc-13-amd64-release' }}
working-directory: ${{ env.BUILD_DIR }}
run: ./xrpld --definitions | python3 -m json.tool > server_definitions.json

- name: Upload server definitions
if: ${{ github.event.repository.visibility == 'public' && inputs.config_name == 'debian-bookworm-gcc-13-amd64-release' }}
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: server-definitions
path: ${{ env.BUILD_DIR }}/server_definitions.json
retention-days: 3
if-no-files-found: error

- name: Check linking (Linux)
if: ${{ runner.os == 'Linux' && env.SANITIZERS_ENABLED == 'false' }}
working-directory: ${{ env.BUILD_DIR }}
Expand Down
17 changes: 13 additions & 4 deletions src/xrpld/app/main/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
#include <xrpld/core/ConfigSections.h>
#include <xrpld/core/TimeKeeper.h>
#include <xrpld/rpc/RPCCall.h>
#include <xrpld/rpc/handlers/Handlers.h>

#include <xrpl/basics/Log.h>
#include <xrpl/beast/core/CurrentThreadName.h>
#include <xrpl/git/Git.h>
#include <xrpl/json/json_writer.h>
#include <xrpl/protocol/BuildInfo.h>
#include <xrpl/server/Vacuum.h>

Expand Down Expand Up @@ -358,10 +360,11 @@
"silent", "No output to the console after startup.")("standalone,a", "Run with no peers.")(
"verbose,v", "Verbose logging.")

("force_ledger_present_range",
po::value<std::string>(),
"Specify the range of present ledgers for testing purposes. Min and "
"max values are comma separated.")("version", "Display the build version.");
("definitions", "Output server definitions as JSON and exit.")(
"force_ledger_present_range",
po::value<std::string>(),
"Specify the range of present ledgers for testing purposes. Min and "
"max values are comma separated.")("version", "Display the build version.");

po::options_description data("Ledger/Data Options");
data.add_options()("import", importText.c_str())(
Expand Down Expand Up @@ -489,6 +492,12 @@
return 0;
}

if (vm.contains("definitions"))
{
std::cout << Json::FastWriter().write(getStaticServerDefinitions());
return 0;

Check warning on line 498 in src/xrpld/app/main/Main.cpp

View check run for this annotation

Codecov / codecov/patch

src/xrpld/app/main/Main.cpp#L498

Added line #L498 was not covered by tests
}

#ifndef ENABLE_TESTS
if (vm.count("unittest") || vm.count("unittest-child"))
{
Expand Down
2 changes: 2 additions & 0 deletions src/xrpld/rpc/handlers/Handlers.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,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
Expand Down
7 changes: 7 additions & 0 deletions src/xrpld/rpc/handlers/server_info/ServerDefinitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,4 +387,11 @@
return defs.get();
}

Json::Value
getStaticServerDefinitions()

Check warning on line 391 in src/xrpld/rpc/handlers/server_info/ServerDefinitions.cpp

View check run for this annotation

Codecov / codecov/patch

src/xrpld/rpc/handlers/server_info/ServerDefinitions.cpp#L391

Added line #L391 was not covered by tests
{
static detail::ServerDefinitions const defs{};
return defs.get();

Check warning on line 394 in src/xrpld/rpc/handlers/server_info/ServerDefinitions.cpp

View check run for this annotation

Codecov / codecov/patch

src/xrpld/rpc/handlers/server_info/ServerDefinitions.cpp#L394

Added line #L394 was not covered by tests
}

} // namespace xrpl
Loading