From c84d5837956065ca6804229cfabcc0a023e9ead5 Mon Sep 17 00:00:00 2001 From: Matt Huntington Date: Wed, 8 Feb 2023 00:55:34 +0000 Subject: [PATCH] use env vars for db connection --- .gitignore | 1 + mysql.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 69720c1..87b6e1d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.swp crow.h a.out +testapp diff --git a/mysql.cpp b/mysql.cpp index 20673ba..22daedc 100644 --- a/mysql.cpp +++ b/mysql.cpp @@ -14,7 +14,7 @@ int main(void){ sql::ResultSet *res; driver = get_driver_instance(); - con = driver->connect("tcp://ipaddress:3306","usr","pwd"); + con = driver->connect(std::getenv("DBURL"),std::getenv("DBUSER"),std::getenv("DBPWD")); con->setSchema("timer_backend"); stmt = con->createStatement(); res = stmt->executeQuery("SELECT seconds FROM sessions;");