Don't throw exception if environment variables are not set.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
tastytea 2019-08-10 20:21:16 +02:00
parent babd67a750
commit 31013f5192
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
3 changed files with 6 additions and 6 deletions

View File

@ -6,7 +6,7 @@ if(${CMAKE_VERSION} VERSION_LESS 3.12)
endif()
project(gitea2rss
VERSION 0.5.0
VERSION 0.5.1
LANGUAGES CXX)
# DESCRIPTION was introduced in version 3.9.

View File

@ -30,7 +30,7 @@ using Poco::Environment;
int main(int argc, char *argv[])
{
const string query = Environment::get("QUERY_STRING");
const string query = Environment::get("QUERY_STRING", "");
string url;
string type = "releases";
@ -40,7 +40,7 @@ int main(int argc, char *argv[])
if (!query.empty())
{
const string baseurl = Environment::get("GITEA2RSS_BASEURL");
const string baseurl = Environment::get("GITEA2RSS_BASEURL", "");
if (baseurl.empty())
{
cout << "Status: 500 Internal Server Error\n\n";

View File

@ -44,9 +44,9 @@ void write_line(const uint8_t spaces, const string &tag, const string &value)
void write_preamble(const string &url, const string &type)
{
const string request_uri = Environment::get("REQUEST_URI");
const string server_name = Environment::get("SERVER_NAME");
const string https = Environment::get("HTTPS");
const string request_uri = Environment::get("REQUEST_URI", "");
const string server_name = Environment::get("SERVER_NAME", "");
const string https = Environment::get("HTTPS", "");
string selfurl;
if (!request_uri.empty() && !server_name.empty())