Skip to content

Commit

Permalink
For compatibility with Now, base64-encode the RSA keys in env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
Don Goodman-Wilson committed Apr 9, 2018
1 parent 47f3934 commit 41f82b2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions conanfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ cpp-jwt/[~=1.0]@DEGoodmanWilson/stable
libsodium/[~=1.0]@bincrafters/stable
cpr/[~=1.3]@DEGoodmanWilson/stable
inja/[~=1.0]@DEGoodmanWilson/stable
base64/[~=1.0]@DEGoodmanWilson/stable

# for testing
Catch/[~=1.9]@bincrafters/stable
Expand Down
6 changes: 4 additions & 2 deletions configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include <regex>
#include <fstream>

#include <base64/base64.h>


std::string read_from_file_(const std::string &path)
{
Expand Down Expand Up @@ -88,8 +90,8 @@ std::string getenvstr_(const std::string &key)
configuration::configuration() :
mongo_uri{getenvstr_("MONGO_URI")},
mailgun_api_key{getenvstr_("MAILGUN_API_KEY")},
public_key{getenv("PUBLIC_KEY")},
private_key{getenv("PRIVATE_KEY")}
public_key{base64_decode(getenv("PUBLIC_KEY"))},
private_key{base64_decode(getenv("PRIVATE_KEY"))}
{
if (mongo_uri.empty())
{
Expand Down

0 comments on commit 41f82b2

Please sign in to comment.