xrpld
Loading...
Searching...
No Matches
envconfig.h
1#pragma once
2
3#include <xrpld/core/Config.h>
4
5#include <atomic>
6#include <cstdint>
7#include <map>
8#include <memory>
9#include <string>
10
11namespace xrpl::test {
12
13extern std::atomic<bool> gEnvUseIPv4;
14
15inline char const*
17{
18 return gEnvUseIPv4 ? "127.0.0.1" : "::1";
19}
20
26extern void
28
29namespace jtx {
30
39{
40 auto p = std::make_unique<Config>();
42 return p;
43}
44
59template <class F, class... Args>
61envconfig(F&& modfunc, Args&&... args)
62{
63 return modfunc(envconfig(), std::forward<Args>(args)...);
64}
65
78
90
92
94
96
98
113
124
136
150 std::string const& certPath,
151 std::string const& keyPath);
152
167 std::string const& certPath,
168 std::string const& keyPath,
169 std::string const& clientCAPath);
170
185 std::string const& certPath,
186 std::string const& keyPath,
187 std::string const& certChainPath);
188
192 std::map<std::string, std::string> extraVoting = {});
193
194} // namespace jtx
195} // namespace xrpl::test
T forward(T... args)
T make_unique(T... args)
std::unique_ptr< Config > addGrpcConfigWithTLSAndCertChain(std::unique_ptr< Config >, std::string const &certPath, std::string const &keyPath, std::string const &certChainPath)
add a grpc address, port and TLS with server cert chain to config
std::unique_ptr< Config > addGrpcConfigWithTLSAndClientCA(std::unique_ptr< Config >, std::string const &certPath, std::string const &keyPath, std::string const &clientCAPath)
add a grpc address, port and TLS certificate/key/client CA paths to config
std::unique_ptr< Config > addGrpcConfigWithTLS(std::unique_ptr< Config >, std::string const &certPath, std::string const &keyPath)
add a grpc address, port and TLS certificate/key paths to config
std::unique_ptr< Config > secureGateway(std::unique_ptr< Config >)
Definition envconfig.cpp:83
std::unique_ptr< Config > secureGatewayLocalnet(std::unique_ptr< Config >)
std::unique_ptr< Config > makeConfig(std::map< std::string, std::string > extraTxQ={}, std::map< std::string, std::string > extraVoting={})
std::unique_ptr< Config > singleThreadIo(std::unique_ptr< Config >)
std::unique_ptr< Config > addGrpcConfigWithSecureGateway(std::unique_ptr< Config >, std::string const &secureGateway)
add a grpc address, port and secureGateway to config
std::unique_ptr< Config > envconfig()
creates and initializes a default configuration for jtx::Env
Definition envconfig.h:38
std::unique_ptr< Config > adminLocalnet(std::unique_ptr< Config >)
Definition envconfig.cpp:92
std::unique_ptr< Config > noAdmin(std::unique_ptr< Config >)
adjust config so no admin ports are enabled
Definition envconfig.cpp:75
std::unique_ptr< Config > addGrpcConfig(std::unique_ptr< Config >)
add a grpc address and port to config
std::unique_ptr< Config > onlineDelete(std::unique_ptr< Config > cfg, std::uint32_t deleteInterval=8)
adjust config to enable online_delete
Definition envconfig.cpp:66
std::unique_ptr< Config > validator(std::unique_ptr< Config >, std::string const &)
adjust configuration with params needed to be a validator
void setupConfigForUnitTests(Config &config)
initializes a config object for use with jtx::Env
Definition envconfig.cpp:21
char const * getEnvLocalhostAddr()
Definition envconfig.h:16
std::atomic< bool > gEnvUseIPv4
Definition envconfig.cpp:18