Add an internal getenv wrapper function: zeekenv

It maps newer environment variable names starting with ZEEK to the
legacy names starting with BRO.
This commit is contained in:
Jon Siwek 2019-05-23 20:40:03 -07:00
parent 580822a32c
commit 7f0fb49612
14 changed files with 82 additions and 81 deletions

View file

@ -177,9 +177,7 @@ void Manager::InitPostScript()
BrokerConfig config{std::move(options)};
auto max_threads_env = getenv("ZEEK_BROKER_MAX_THREADS");
if ( ! max_threads_env )
max_threads_env = getenv("BRO_BROKER_MAX_THREADS");
auto max_threads_env = zeekenv("ZEEK_BROKER_MAX_THREADS");
if ( max_threads_env )
config.set("scheduler.max-threads", atoi(max_threads_env));
@ -305,9 +303,7 @@ void Manager::Peer(const string& addr, uint16_t port, double retry)
DBG_LOG(DBG_BROKER, "Starting to peer with %s:%" PRIu16,
addr.c_str(), port);
auto e = getenv("ZEEK_DEFAULT_CONNECT_RETRY");
if ( ! e )
e = getenv("BRO_DEFAULT_CONNECT_RETRY");
auto e = zeekenv("ZEEK_DEFAULT_CONNECT_RETRY");
if ( e )
retry = atoi(e);