Skip to content

Commit

Permalink
Use qgetenv and fix log level critical
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Jan 22, 2020
1 parent de5903a commit 2771c83
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/server/qgis_mapserver.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ int main( int argc, char *argv[] )
// minimal, minimalegl, offscreen, wayland-egl, wayland, xcb. // minimal, minimalegl, offscreen, wayland-egl, wayland, xcb.
// https://www.ics.com/blog/qt-tips-and-tricks-part-1 // https://www.ics.com/blog/qt-tips-and-tricks-part-1
// http://doc.qt.io/qt-5/qpa.html // http://doc.qt.io/qt-5/qpa.html
const char *display = getenv( "DISPLAY" ); const char *display = qgetenv( "DISPLAY" );
bool withDisplay = true; bool withDisplay = true;
if ( !display ) if ( !display )
{ {
Expand All @@ -110,9 +110,9 @@ int main( int argc, char *argv[] )
#endif #endif


// The port to listen // The port to listen
QString serverPort { getenv( "QGIS_SERVER_PORT" ) }; QString serverPort { qgetenv( "QGIS_SERVER_PORT" ) };
// The address to listen // The address to listen
QString ipAddress { getenv( "QGIS_SERVER_ADDRESS" ) }; QString ipAddress { qgetenv( "QGIS_SERVER_ADDRESS" ) };


if ( serverPort.isEmpty() ) if ( serverPort.isEmpty() )
{ {
Expand All @@ -135,7 +135,7 @@ int main( int argc, char *argv[] )
QCommandLineOption logLevelOption( "l", QObject::tr( "Set log level (default: 0)\n" QCommandLineOption logLevelOption( "l", QObject::tr( "Set log level (default: 0)\n"
"0: INFO\n" "0: INFO\n"
"1: WARNING\n" "1: WARNING\n"
"3: CRITICAL" ), "logLevel", "0" ); "2: CRITICAL" ), "logLevel", "0" );
parser.addOption( logLevelOption ); parser.addOption( logLevelOption );


parser.process( app ); parser.process( app );
Expand Down Expand Up @@ -271,7 +271,7 @@ int main( int argc, char *argv[] )
} }


// Build URL from env ... // Build URL from env ...
QString url { getenv( "REQUEST_URI" ) }; QString url { qgetenv( "REQUEST_URI" ) };
// ... or from server ip/port and request path // ... or from server ip/port and request path
if ( url.isEmpty() ) if ( url.isEmpty() )
{ {
Expand Down

0 comments on commit 2771c83

Please sign in to comment.