Skip to content

Commit

Permalink
LavaTool is smarter than using hard coded
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewQuijano committed Aug 27, 2024
1 parent d68ce19 commit 37c65ed
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion tools/lavaTool/src/lavaTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "lexpr.hxx"
#include "lavaTool.h"
#include "MatchFinder.h"
#include <cstdlib>

void parse_whitelist(std::string whitelist_filename) {
debug(FNARG) << "parsing white list " << whitelist_filename << "\n";
Expand Down Expand Up @@ -66,7 +67,27 @@ int main(int argc, const char **argv) {
errs() << "Error: Specify a database name with \"--db [name]\". Exiting . . .\n";
exit(1);
}
db.reset(new odb::pgsql::database("postgres", "postgrespostgres",
const char* pgpass = std::getenv("PGPASS");
const char* pguser = std::getenv("PGUSER");
if (pgpass) {
// PGPASS environment variable is set, and pgpass points to its value.
std::cout << "PGPASS IS SET" << std::endl;
} else {
// PGPASS environment variable is not set.
std::cout << "PGPASS is not set" << std::endl;
exit(1);
}

if (pguser) {
// PGUSER environment variable is set, and pgpass points to its value.
std::cout << "PGUSER IS SET: " << pguser << std::endl;
} else {
// PGUSER environment variable is not set.
std::cout << "PGUSER is not set" << std::endl;
exit(1);
}

db.reset(new odb::pgsql::database(pguser, pgpass,
DBName, DBHost, DBPort));
t = new odb::transaction(db->begin());

Expand Down

0 comments on commit 37c65ed

Please sign in to comment.