@ -12,7 +12,7 @@ struct Connection : pqxx::connection
|
||||
std::string getFlags()
|
||||
{
|
||||
using namespace nix;
|
||||
auto s = getEnv("HYDRA_DBI", "dbi:Pg:dbname=hydra;");
|
||||
auto s = getEnv("HYDRA_DBI").value_or("dbi:Pg:dbname=hydra;");
|
||||
std::string prefix = "dbi:Pg:";
|
||||
if (std::string(s, 0, prefix.size()) != prefix)
|
||||
throw Error("$HYDRA_DBI does not denote a PostgreSQL database");
|
||||
|
@ -14,9 +14,9 @@ struct Config
|
||||
|
||||
/* Read hydra.conf. */
|
||||
auto hydraConfigFile = getEnv("HYDRA_CONFIG");
|
||||
if (pathExists(hydraConfigFile)) {
|
||||
if (hydraConfigFile && pathExists(*hydraConfigFile)) {
|
||||
|
||||
for (auto line : tokenizeString<Strings>(readFile(hydraConfigFile), "\n")) {
|
||||
for (auto line : tokenizeString<Strings>(readFile(*hydraConfigFile), "\n")) {
|
||||
line = trim(string(line, 0, line.find('#')));
|
||||
|
||||
auto eq = line.find('=');
|
||||
|
Reference in New Issue
Block a user