Skip to content

Commit ccda1c4

Browse files
author
Stéphane Brunner
committed
Add QGIS_PROJECT_FILE environement option
To be able to configure the project file in apache configuration like: SetEnv QGIS_PROJECT_FILE <path to project file>.qgs
1 parent 02ed712 commit ccda1c4

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/mapserver/qgis_map_serv.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,14 +297,22 @@ int main( int argc, char * argv[] )
297297
//set admin config file to wms server object
298298
QString configFilePath( defaultConfigFilePath );
299299

300-
paramIt = parameterMap.find( "MAP" );
301-
if ( paramIt == parameterMap.constEnd() )
300+
QString projectFile = getenv( "QGIS_PROJECT_FILE" );
301+
if ( !projectFile.isEmpty() )
302302
{
303-
QgsDebugMsg( QString( "Using default configuration file path: %1" ).arg( defaultConfigFilePath ) );
303+
configFilePath = projectFile;
304304
}
305305
else
306306
{
307-
configFilePath = paramIt.value();
307+
paramIt = parameterMap.find( "MAP" );
308+
if ( paramIt == parameterMap.constEnd() )
309+
{
310+
QgsDebugMsg( QString( "Using default configuration file path: %1" ).arg( defaultConfigFilePath ) );
311+
}
312+
else
313+
{
314+
configFilePath = paramIt.value();
315+
}
308316
}
309317

310318
QgsConfigParser* adminConfigParser = QgsConfigCache::instance()->searchConfiguration( configFilePath );

0 commit comments

Comments
 (0)