Skip to content

Commit 1fbefa0

Browse files
committed
Remove hardcoded CCDB path
1 parent 55db997 commit 1fbefa0

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

DataFormats/Parameters/src/GRPTool.cxx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
// or submit itself to any jurisdiction.
1111

1212
#include <boost/program_options.hpp>
13+
#include <cstdlib>
1314
#include <string>
1415
#include "DataFormatsParameters/GRPECSObject.h"
1516
#include "DataFormatsParameters/GRPMagField.h"
@@ -43,6 +44,19 @@ enum class GRPCommand {
4344
kPRINTMAG
4445
};
4546

47+
// CCDB host, overridable via ALICEO2_CCDB_HOST as the CCDB test suites do.
48+
// Without it this tool always contacts alice-ccdb.cern.ch, which CcdbApi flags
49+
// as needing an alien token -- fatal in CI, where CCDB is reached through a
50+
// local proxy instead.
51+
namespace
52+
{
53+
std::string defaultCCDBHost()
54+
{
55+
const char* host = std::getenv("ALICEO2_CCDB_HOST");
56+
return (host && *host) ? std::string(host) : std::string("http://alice-ccdb.cern.ch");
57+
}
58+
} // namespace
59+
4660
// options struct filled from command line
4761
struct Options {
4862
std::vector<std::string> readout;
@@ -60,7 +74,7 @@ struct Options {
6074
bool print = false; // whether to print outcome of GRP operation
6175
bool lhciffromccdb = false; // whether only to take GRPLHCIF from CCDB
6276
std::string publishto = "";
63-
std::string ccdbhost = "http://alice-ccdb.cern.ch";
77+
std::string ccdbhost = defaultCCDBHost();
6478
bool isRun5 = false; // whether or not this is supposed to be a Run5 detector configuration
6579
std::string vertex = "ccdb";
6680
std::string configKeyValues = "";

0 commit comments

Comments
 (0)