From c702f1d255f8295c64b5ca6631a4f4b41b34942b Mon Sep 17 00:00:00 2001
From: Dan Goodliffe <dan@randomdan.homeip.net>
Date: Mon, 31 May 2021 17:35:33 +0100
Subject: Read test DB connection details from env

---
 lib/helpers.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

(limited to 'lib')

diff --git a/lib/helpers.h b/lib/helpers.h
index a8a630e..d2584d0 100644
--- a/lib/helpers.h
+++ b/lib/helpers.h
@@ -3,6 +3,7 @@
 
 #include <concepts>
 #include <cstdint>
+#include <cstdlib>
 #include <string>
 #include <utility>
 
@@ -49,6 +50,15 @@ namespace MyGrate {
 			a.size()
 			} -> std::integral;
 	};
+
+	inline const char *
+	getenv(const char * env, const char * dfl)
+	{
+		if (const auto e {::getenv(env)}) {
+			return e;
+		}
+		return dfl;
+	}
 }
 
 #endif
-- 
cgit v1.2.3