From ade19e6f482d75bd8677c9b1d8b41ab35b4dfb41 Mon Sep 17 00:00:00 2001
From: Michael Davis <michael.davis@cern.ch>
Date: Fri, 9 Mar 2018 11:12:35 +0100
Subject: [PATCH] Adds same config options to cta-wfe-test

---
 cmdline/EosCtaStub.cpp | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/cmdline/EosCtaStub.cpp b/cmdline/EosCtaStub.cpp
index e849a741c1..05e1267aba 100644
--- a/cmdline/EosCtaStub.cpp
+++ b/cmdline/EosCtaStub.cpp
@@ -255,35 +255,38 @@ void fillNotification(cta::eos::Notification &notification, int argc, const char
 int exceptionThrowingMain(int argc, const char *const *const argv)
 {
    // Verify that the Google Protocol Buffer header and linked library versions are compatible
-
    GOOGLE_PROTOBUF_VERIFY_VERSION;
 
    cta::xrd::Request request;
    cta::eos::Notification &notification = *(request.mutable_notification());
 
    // Parse the command line arguments: fill the Notification fields
-
    fillNotification(notification, argc, argv);
 
    // Get socket address of CTA Frontend endpoint
-
    cta::cmdline::Configuration cliConf("/etc/cta/cta-cli.conf");
    std::string endpoint = cliConf.getFrontendHostAndPort();
 
-   // Obtain a Service Provider
+   // Set configuration options
+   XrdSsiPb::Config config;
+   config.getEnv("request_timeout", "XRD_REQUESTTIMEOUT");   // environment variable can override default
 
-   std::string resource("/ctafrontend");
+   // If XRDDEBUG=1, switch on all logging
+   if(getenv("XRDDEBUG")) {
+      config.set("log", "all");
+   }
+   // If fine-grained control over log level is required, use XrdSsiPbLogLevel
+   config.getEnv("log", "XrdSsiPbLogLevel");
 
+   // Obtain a Service Provider
+   std::string resource("/ctafrontend");
    XrdSsiPbServiceType cta_service(endpoint, resource);
 
    // Send the Request to the Service and get a Response
-
    cta::xrd::Response response;
-  
    cta_service.Send(request, response);
 
    // Handle responses
-
    switch(response.type())
    {
       using namespace cta::xrd;
@@ -297,7 +300,6 @@ int exceptionThrowingMain(int argc, const char *const *const argv)
    }
 
    // Delete all global objects allocated by libprotobuf
-
    google::protobuf::ShutdownProtobufLibrary();
 
    return 0;
-- 
GitLab