diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-05-31 17:35:33 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-05-31 22:21:49 +0100 |
commit | c702f1d255f8295c64b5ca6631a4f4b41b34942b (patch) | |
tree | 02739566bb57c34dfa21698da1a28d65fe4c73de /lib | |
parent | Initial commit of prepstmt, selects, record sets (diff) | |
download | mygrate-c702f1d255f8295c64b5ca6631a4f4b41b34942b.tar.bz2 mygrate-c702f1d255f8295c64b5ca6631a4f4b41b34942b.tar.xz mygrate-c702f1d255f8295c64b5ca6631a4f4b41b34942b.zip |
Read test DB connection details from env
Diffstat (limited to 'lib')
-rw-r--r-- | lib/helpers.h | 10 |
1 files changed, 10 insertions, 0 deletions
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 |