rippled
envconfig.h
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2012-2017 Ripple Labs Inc.
5 
6  Permission to use, copy, modify, and/or distribute this software for any
7  purpose with or without fee is hereby granted, provided that the above
8  copyright notice and this permission notice appear in all copies.
9 
10  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 //==============================================================================
19 
20 #ifndef RIPPLE_TEST_JTX_ENVCONFIG_H_INCLUDED
21 #define RIPPLE_TEST_JTX_ENVCONFIG_H_INCLUDED
22 
23 #include <ripple/core/Config.h>
24 
25 namespace ripple {
26 namespace test {
27 
28 // frequently used macros defined here for convinience.
29 #define PORT_WS "port_ws"
30 #define PORT_RPC "port_rpc"
31 #define PORT_PEER "port_peer"
32 
34 
35 inline const char*
37 {
38  return envUseIPv4 ? "127.0.0.1" : "::1";
39 }
40 
44 extern void
46 
47 namespace jtx {
48 
55 {
56  auto p = std::make_unique<Config>();
58  return p;
59 }
60 
73 template <class F, class... Args>
75 envconfig(F&& modfunc, Args&&... args)
76 {
77  return modfunc(envconfig(), std::forward<Args>(args)...);
78 }
79 
89 
91 
93 
95 
108 
121 
130 
141  std::string const& secureGateway);
142 
143 } // namespace jtx
144 } // namespace test
145 } // namespace ripple
146 
147 #endif
ripple::test::jtx::secure_gateway
std::unique_ptr< Config > secure_gateway(std::unique_ptr< Config >)
Definition: envconfig.cpp:89
std::string
STL class.
ripple::test::jtx::validator
std::unique_ptr< Config > validator(std::unique_ptr< Config >, std::string const &)
adjust configuration with params needed to be a validator
Definition: envconfig.cpp:118
ripple::test::jtx::addGrpcConfig
std::unique_ptr< Config > addGrpcConfig(std::unique_ptr< Config >)
add a grpc address and port to config
Definition: envconfig.cpp:142
ripple::test::jtx::port_increment
std::unique_ptr< Config > port_increment(std::unique_ptr< Config >, int)
adjust the default configured server ports by a specified value
Definition: envconfig.cpp:127
ripple::test::jtx::addGrpcConfigWithSecureGateway
std::unique_ptr< Config > addGrpcConfigWithSecureGateway(std::unique_ptr< Config >, std::string const &secureGateway)
add a grpc address, port and secure_gateway to config
Definition: envconfig.cpp:151
ripple::test::jtx::envconfig
std::unique_ptr< Config > envconfig()
creates and initializes a default configuration for jtx::Env
Definition: envconfig.h:54
ripple::test::jtx::admin_localnet
std::unique_ptr< Config > admin_localnet(std::unique_ptr< Config >)
Definition: envconfig.cpp:98
ripple::test::getEnvLocalhostAddr
const char * getEnvLocalhostAddr()
Definition: envconfig.h:36
ripple::test::jtx::no_admin
std::unique_ptr< Config > no_admin(std::unique_ptr< Config >)
adjust config so no admin ports are enabled
Definition: envconfig.cpp:81
ripple::Config
Definition: Config.h:92
std::atomic< bool >
ripple::test::envUseIPv4
std::atomic< bool > envUseIPv4
Definition: envconfig.cpp:35
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::test::jtx::secure_gateway_localnet
std::unique_ptr< Config > secure_gateway_localnet(std::unique_ptr< Config >)
Definition: envconfig.cpp:106
std::unique_ptr
STL class.
ripple::test::setupConfigForUnitTests
void setupConfigForUnitTests(Config &config)
initializes a config object for use with jtx::Env
Definition: envconfig.cpp:38