QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgsserversettings.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsserversettings.cpp
3  ---------------------
4  begin : December 19, 2016
5  copyright : (C) 2016 by Paul Blottiere
6  email : paul dot blottiere at oslandia dot com
7 
8 ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 
19 #include "qgsserversettings.h"
20 #include "qgsapplication.h"
21 
22 #include <QSettings>
23 #include <QDir>
24 
26 {
27  load();
28 }
29 
30 void QgsServerSettings::initSettings()
31 {
32  mSettings.clear();
33 
34  // options path
35  const Setting sOptPath = { QgsServerSettingsEnv::QGIS_OPTIONS_PATH,
37  QStringLiteral( "Override the default path for user configuration" ),
38  QString(),
39  QVariant::String,
40  QVariant( "" ),
41  QVariant()
42  };
43  mSettings[ sOptPath.envVar ] = sOptPath;
44 
45  // parallel rendering
48  QStringLiteral( "Activate/Deactivate parallel rendering for WMS getMap request" ),
49  QStringLiteral( "/qgis/parallel_rendering" ),
50  QVariant::Bool,
51  QVariant( false ),
52  QVariant()
53  };
54  mSettings[ sParRend.envVar ] = sParRend;
55 
56  // max threads
57  const Setting sMaxThreads = { QgsServerSettingsEnv::QGIS_SERVER_MAX_THREADS,
59  QStringLiteral( "Number of threads to use when parallel rendering is activated" ),
60  QStringLiteral( "/qgis/max_threads" ),
61  QVariant::Int,
62  QVariant( -1 ),
63  QVariant()
64  };
65  mSettings[ sMaxThreads.envVar ] = sMaxThreads;
66 
67  // log level
68  const Setting sLogLevel = { QgsServerSettingsEnv::QGIS_SERVER_LOG_LEVEL,
70  QStringLiteral( "Log level" ),
71  QString(),
72  QVariant::Int,
73  QVariant( Qgis::None ),
74  QVariant()
75  };
76  mSettings[ sLogLevel.envVar ] = sLogLevel;
77 
78  // log file
79  const Setting sLogFile = { QgsServerSettingsEnv::QGIS_SERVER_LOG_FILE,
81  QStringLiteral( "Log file" ),
82  QString(),
83  QVariant::String,
84  QVariant( "" ),
85  QVariant()
86  };
87  mSettings[ sLogFile.envVar ] = sLogFile;
88 
89  // log to stderr
90  const Setting sLogStderr = { QgsServerSettingsEnv::QGIS_SERVER_LOG_STDERR,
92  QStringLiteral( "Activate/Deactivate logging to stderr" ),
93  QString(),
94  QVariant::Bool,
95  QVariant( false ),
96  QVariant()
97  };
98  mSettings[ sLogStderr.envVar ] = sLogStderr;
99 
100  // project file
101  const Setting sProject = { QgsServerSettingsEnv::QGIS_PROJECT_FILE,
103  QStringLiteral( "QGIS project file" ),
104  QString(),
105  QVariant::String,
106  QVariant( "" ),
107  QVariant()
108  };
109  mSettings[ sProject.envVar ] = sProject;
110 
111  // max cache layers
112  const Setting sMaxCacheLayers = { QgsServerSettingsEnv::MAX_CACHE_LAYERS,
114  QStringLiteral( "Specify the maximum number of cached layers" ),
115  QString(),
116  QVariant::Int,
117  QVariant( 100 ),
118  QVariant()
119  };
120  mSettings[ sMaxCacheLayers.envVar ] = sMaxCacheLayers;
121 
122  // cache directory
123  const Setting sCacheDir = { QgsServerSettingsEnv::QGIS_SERVER_CACHE_DIRECTORY,
125  QStringLiteral( "Specify the cache directory" ),
126  QStringLiteral( "/cache/directory" ),
127  QVariant::String,
128  QVariant( QgsApplication::qgisSettingsDirPath() + "cache" ),
129  QVariant()
130  };
131  mSettings[ sCacheDir.envVar ] = sCacheDir;
132 
133  // cache size
134  const Setting sCacheSize = { QgsServerSettingsEnv::QGIS_SERVER_CACHE_SIZE,
136  QStringLiteral( "Specify the cache size" ),
137  QStringLiteral( "/cache/size" ),
138  QVariant::LongLong,
139  QVariant( 50 * 1024 * 1024 ),
140  QVariant()
141  };
142  mSettings[ sCacheSize.envVar ] = sCacheSize;
143 
144  // system locale override
145  const Setting sOverrideSystemLocale = { QgsServerSettingsEnv::QGIS_SERVER_OVERRIDE_SYSTEM_LOCALE,
147  QStringLiteral( "Override system locale" ),
148  QStringLiteral( "/locale/userLocale" ),
149  QVariant::String,
150  QVariant( "" ),
151  QVariant()
152  };
153  mSettings[ sOverrideSystemLocale.envVar ] = sOverrideSystemLocale;
154 
155  // bad layers handling
156  const Setting sIgnoreBadLayers = { QgsServerSettingsEnv::QGIS_SERVER_IGNORE_BAD_LAYERS,
158  QStringLiteral( "Ignore bad layers" ),
159  QString(),
160  QVariant::Bool,
161  QVariant( false ),
162  QVariant()
163  };
164  mSettings[ sIgnoreBadLayers.envVar ] = sIgnoreBadLayers;
165 
166  // trust layer metadata
167  const Setting sTrustLayerMetadata = { QgsServerSettingsEnv::QGIS_SERVER_TRUST_LAYER_METADATA,
169  QStringLiteral( "Trust layer metadata" ),
170  QString(),
171  QVariant::Bool,
172  QVariant( false ),
173  QVariant()
174  };
175  mSettings[ sTrustLayerMetadata.envVar ] = sTrustLayerMetadata;
176 
177  // don't load layouts
178  const Setting sDontLoadLayouts = { QgsServerSettingsEnv::QGIS_SERVER_DISABLE_GETPRINT,
180  QStringLiteral( "Don't load layouts" ),
181  QString(),
182  QVariant::Bool,
183  QVariant( false ),
184  QVariant()
185  };
186  mSettings[ sDontLoadLayouts.envVar ] = sDontLoadLayouts;
187 
188  // show group separator
189  const Setting sShowGroupSeparator = { QgsServerSettingsEnv::QGIS_SERVER_SHOW_GROUP_SEPARATOR,
191  QStringLiteral( "Show group (thousands) separator" ),
192  QStringLiteral( "/locale/showGroupSeparator" ),
193  QVariant::String,
194  QVariant( false ),
195  QVariant()
196  };
197  mSettings[ sShowGroupSeparator.envVar ] = sShowGroupSeparator;
198 
199  // max height
200  const Setting sMaxHeight = { QgsServerSettingsEnv::QGIS_SERVER_WMS_MAX_HEIGHT,
202  QStringLiteral( "Maximum height for a WMS request. The lower one of this and the project configuration is used." ),
203  QStringLiteral( "/qgis/max_wms_height" ),
204  QVariant::LongLong,
205  QVariant( -1 ),
206  QVariant()
207  };
208  mSettings[ sMaxHeight.envVar ] = sMaxHeight;
209 
210  // max width
211  const Setting sMaxWidth = { QgsServerSettingsEnv::QGIS_SERVER_WMS_MAX_WIDTH,
213  QStringLiteral( "Maximum width for a WMS request. The most conservative between this and the project one is used" ),
214  QStringLiteral( "/qgis/max_wms_width" ),
215  QVariant::LongLong,
216  QVariant( -1 ),
217  QVariant()
218  };
219  mSettings[ sMaxWidth.envVar ] = sMaxWidth;
220 
221  // API templates and static override directory
222  const Setting sApiResourcesDirectory = { QgsServerSettingsEnv::QGIS_SERVER_API_RESOURCES_DIRECTORY,
224  QStringLiteral( "Base directory where HTML templates and static assets (e.g. images, js and css files) are searched for" ),
225  QStringLiteral( "/qgis/server_api_resources_directory" ),
226  QVariant::String,
227  QDir( QgsApplication::pkgDataPath() ).absoluteFilePath( QStringLiteral( "resources/server/api" ) ),
228  QString()
229  };
230 
231  mSettings[ sApiResourcesDirectory.envVar ] = sApiResourcesDirectory;
232 
233  // API WFS3 max limit
234  const Setting sApiWfs3MaxLimit = { QgsServerSettingsEnv::QGIS_SERVER_API_WFS3_MAX_LIMIT,
236  QStringLiteral( "Maximum value for \"limit\" in a features request, defaults to 10000" ),
237  QStringLiteral( "/qgis/server_api_wfs3_max_limit" ),
238  QVariant::LongLong,
239  QVariant( 10000 ),
240  QVariant()
241  };
242 
243  mSettings[ sApiWfs3MaxLimit.envVar ] = sApiWfs3MaxLimit;
244 
245  // projects directory for landing page service
246  const Setting sProjectsDirectories = { QgsServerSettingsEnv::QGIS_SERVER_LANDING_PAGE_PROJECTS_DIRECTORIES,
248  QStringLiteral( "Directories used by the landing page service to find .qgs and .qgz projects" ),
249  QStringLiteral( "/qgis/server_projects_directories" ),
250  QVariant::String,
251  QVariant( "" ),
252  QVariant()
253  };
254 
255  mSettings[ sProjectsDirectories.envVar ] = sProjectsDirectories;
256 
257  // postgresql connection string for landing page service
258  const Setting sProjectsPgConnections = { QgsServerSettingsEnv::QGIS_SERVER_LANDING_PAGE_PROJECTS_PG_CONNECTIONS,
260  QStringLiteral( "PostgreSQL connection strings used by the landing page service to find projects" ),
261  QStringLiteral( "/qgis/server_projects_pg_connections" ),
262  QVariant::String,
263  QVariant( "" ),
264  QVariant()
265  };
266 
267  mSettings[ sProjectsPgConnections.envVar ] = sProjectsPgConnections;
268 }
269 
271 {
272  // init settings each time to take into account QgsApplication and
273  // QCoreApplication configuration for some default values
274  initSettings();
275 
276  // store environment variables
277  QMap<QgsServerSettingsEnv::EnvVar, QString> env = getEnv();
278 
279  // load QSettings if QGIS_OPTIONS_PATH is defined
280  loadQSettings( env[ QgsServerSettingsEnv::QGIS_OPTIONS_PATH ] );
281 
282  // prioritize values: 'env var' -> 'ini file' -> 'default value'
283  prioritize( env );
284 }
285 
286 bool QgsServerSettings::load( const QString &envVarName )
287 {
288  bool rc( false );
289  const QMetaEnum metaEnum( QMetaEnum::fromType<QgsServerSettingsEnv::EnvVar>() );
290  const int value = metaEnum.keyToValue( envVarName.toStdString().c_str() );
291 
292  if ( value >= 0 )
293  {
294  const QString envValue( getenv( envVarName.toStdString().c_str() ) );
295  prioritize( QMap<QgsServerSettingsEnv::EnvVar, QString> { {( QgsServerSettingsEnv::EnvVar ) value, envValue } } );
296  rc = true;
297  }
298 
299  return rc;
300 }
301 
302 QMap<QgsServerSettingsEnv::EnvVar, QString> QgsServerSettings::getEnv() const
303 {
304  QMap<QgsServerSettingsEnv::EnvVar, QString> env;
305 
306  const QMetaEnum metaEnum( QMetaEnum::fromType<QgsServerSettingsEnv::EnvVar>() );
307  for ( int i = 0; i < metaEnum.keyCount(); i++ )
308  {
309  env[( QgsServerSettingsEnv::EnvVar ) metaEnum.value( i )] = getenv( metaEnum.key( i ) );
310  }
311 
312  return env;
313 }
314 
315 QVariant QgsServerSettings::value( QgsServerSettingsEnv::EnvVar envVar, bool actual ) const
316 {
317  if ( actual )
318  {
319  const QString envValue( getenv( name( envVar ).toStdString().c_str() ) );
320 
321  if ( ! envValue.isEmpty() )
322  return envValue;
323  }
324 
325  if ( mSettings[ envVar ].src == QgsServerSettingsEnv::DEFAULT_VALUE )
326  {
327  return mSettings[ envVar ].defaultVal;
328  }
329  else
330  {
331  return mSettings[ envVar ].val;
332  }
333 }
334 
335 void QgsServerSettings::loadQSettings( const QString &envOptPath ) const
336 {
337  if ( ! envOptPath.isEmpty() )
338  {
339  QSettings::setDefaultFormat( QSettings::IniFormat );
340  QSettings::setPath( QSettings::IniFormat, QSettings::UserScope, envOptPath );
341  }
342 }
343 
344 void QgsServerSettings::prioritize( const QMap<QgsServerSettingsEnv::EnvVar, QString> &env )
345 {
346  for ( QgsServerSettingsEnv::EnvVar e : env.keys() )
347  {
348  Setting s = mSettings[ e ];
349 
350  QVariant varValue;
351  if ( ! env.value( e ).isEmpty() )
352  {
353  varValue.setValue( env.value( e ) );
354  }
355 
356  if ( ! varValue.isNull() && varValue.canConvert( s.type ) )
357  {
358  s.val = varValue;
360  }
361  else if ( ! s.iniKey.isEmpty() && QSettings().contains( s.iniKey ) && QSettings().value( s.iniKey ).canConvert( s.type ) )
362  {
363  s.val = QSettings().value( s.iniKey );
365  }
366  else
367  {
368  s.val = QVariant();
370  }
371 
372  // an empty string can be returned from QSettings. In this case, we want
373  // to use the default value
374  if ( s.type == QVariant::String && s.val.toString().isEmpty() )
375  {
376  s.val = QVariant();
378  }
379 
380  mSettings[ e ] = s;
381  }
382 }
383 
385 {
386  const QMetaEnum metaEnumEnv( QMetaEnum::fromType<QgsServerSettingsEnv::EnvVar>() );
387  return metaEnumEnv.valueToKey( env );
388 }
389 
391 {
392  const QMetaEnum metaEnumSrc( QMetaEnum::fromType<QgsServerSettingsEnv::Source>() );
393 
394  QgsMessageLog::logMessage( "QGIS Server Settings: ", "Server", Qgis::Info );
395  for ( Setting s : mSettings )
396  {
397  const QString src = metaEnumSrc.valueToKey( s.src );
398  const QString var = name( s.envVar );
399 
400  const QString msg = " - " + var + " / '" + s.iniKey + "' (" + s.descr + "): '" + value( s.envVar ).toString() + "' (read from " + src + ")";
401  QgsMessageLog::logMessage( msg, "Server", Qgis::Info );
402  }
403 
404  if ( ! iniFile().isEmpty() )
405  {
406  const QString msg = "Ini file used to initialize settings: " + iniFile();
407  QgsMessageLog::logMessage( msg, "Server", Qgis::Info );
408  }
409 }
410 
411 // getter
413 {
414  return QSettings().fileName();
415 }
416 
418 {
420 }
421 
423 {
424  return value( QgsServerSettingsEnv::QGIS_SERVER_MAX_THREADS ).toInt();
425 }
426 
428 {
429  return value( QgsServerSettingsEnv::QGIS_SERVER_LOG_FILE ).toString();
430 }
431 
433 {
434  return value( QgsServerSettingsEnv::QGIS_SERVER_LOG_STDERR ).toBool();
435 }
436 
438 {
439  return static_cast<Qgis::MessageLevel>( value( QgsServerSettingsEnv::QGIS_SERVER_LOG_LEVEL ).toInt() );
440 }
441 
443 {
444  return value( QgsServerSettingsEnv::MAX_CACHE_LAYERS ).toInt();
445 }
446 
448 {
449  return value( QgsServerSettingsEnv::QGIS_PROJECT_FILE ).toString();
450 }
451 
453 {
454  return value( QgsServerSettingsEnv::QGIS_SERVER_CACHE_SIZE ).toLongLong();
455 }
456 
458 {
459  return value( QgsServerSettingsEnv::QGIS_SERVER_CACHE_DIRECTORY ).toString();
460 }
461 
463 {
465 }
466 
468 {
470 }
471 
473 {
474  return value( QgsServerSettingsEnv::QGIS_SERVER_WMS_MAX_HEIGHT ).toInt();
475 }
476 
478 {
479  return value( QgsServerSettingsEnv::QGIS_SERVER_WMS_MAX_WIDTH ).toInt();
480 }
481 
483 {
485 }
486 
488 {
490 }
491 
493 {
495 }
496 
498 {
499  return value( QgsServerSettingsEnv::QGIS_SERVER_API_WFS3_MAX_LIMIT ).toLongLong();
500 }
501 
503 {
505 }
506 
508 {
510 }
511 
513 {
515 }
QgsServerSettings::getPrintDisabled
bool getPrintDisabled() const
Returns true if WMS GetPrint request is disabled and the project's reading flag QgsProject::ReadFlag:...
Definition: qgsserversettings.cpp:512
qgsserversettings.h
QgsServerSettings::QgsServerSettings
QgsServerSettings()
Constructor.
Definition: qgsserversettings.cpp:25
QgsServerSettings::iniFile
QString iniFile() const
Returns the ini file loaded by QSetting.
Definition: qgsserversettings.cpp:412
QgsServerSettings::landingPageProjectsPgConnections
QString landingPageProjectsPgConnections() const
Returns the PostgreSQL connection strings used by the landing page service to find projects.
Definition: qgsserversettings.cpp:487
QgsServerSettings::wmsMaxWidth
int wmsMaxWidth() const
Returns the server-wide max width of a WMS GetMap request.
Definition: qgsserversettings.cpp:477
QgsServerSettingsEnv::MAX_CACHE_LAYERS
@ MAX_CACHE_LAYERS
Definition: qgsserversettings.h:60
QgsServerSettings::apiWfs3MaxLimit
qlonglong apiWfs3MaxLimit() const
Returns the server-wide maximum allowed value for "limit" in a features request.
Definition: qgsserversettings.cpp:497
QgsServerSettings::landingPageProjectsDirectories
QString landingPageProjectsDirectories() const
Returns the directories used by the landing page service to find .qgs and .qgz projects.
Definition: qgsserversettings.cpp:482
QgsServerSettingsEnv::QGIS_SERVER_CACHE_DIRECTORY
@ QGIS_SERVER_CACHE_DIRECTORY
Definition: qgsserversettings.h:62
QgsServerSettingsEnv::ENVIRONMENT_VARIABLE
@ ENVIRONMENT_VARIABLE
Definition: qgsserversettings.h:45
QgsServerSettingsEnv::DEFAULT_VALUE
@ DEFAULT_VALUE
Definition: qgsserversettings.h:44
QgsServerSettings::cacheDirectory
QString cacheDirectory() const
Returns the cache directory.
Definition: qgsserversettings.cpp:457
QgsServerSettingsEnv::QGIS_SERVER_DISABLE_GETPRINT
@ QGIS_SERVER_DISABLE_GETPRINT
Disabled WMS GetPrint request and don't load layouts. Improves project read time. (since QGIS 3....
Definition: qgsserversettings.h:71
QgsServerSettingsEnv::QGIS_SERVER_CACHE_SIZE
@ QGIS_SERVER_CACHE_SIZE
Definition: qgsserversettings.h:63
QgsServerSettings::maxCacheLayers
int maxCacheLayers() const
Returns the maximum number of cached layers.
Definition: qgsserversettings.cpp:442
QgsServerSettingsEnv::QGIS_SERVER_LOG_LEVEL
@ QGIS_SERVER_LOG_LEVEL
Definition: qgsserversettings.h:56
qgsapplication.h
QgsServerSettings::trustLayerMetadata
bool trustLayerMetadata() const
Returns true if the reading flag trust layer metadata is activated.
Definition: qgsserversettings.cpp:507
QgsApplication::qgisSettingsDirPath
static QString qgisSettingsDirPath()
Returns the path to the settings directory in user's home dir.
Definition: qgsapplication.cpp:993
QgsServerSettings::showGroupSeparator
bool showGroupSeparator() const
Show group (thousand) separator.
Definition: qgsserversettings.cpp:467
QgsServerSettingsEnv::QGIS_SERVER_TRUST_LAYER_METADATA
@ QGIS_SERVER_TRUST_LAYER_METADATA
Trust layer metadata. Improves project read time. (since QGIS 3.16).
Definition: qgsserversettings.h:70
QgsServerSettings::projectFile
QString projectFile() const
Returns the QGS project file to use.
Definition: qgsserversettings.cpp:447
QgsServerSettings::logFile
QString logFile() const
Returns the log file.
Definition: qgsserversettings.cpp:427
Qgis::Info
@ Info
Definition: qgis.h:90
QgsServerSettingsEnv::QGIS_SERVER_PARALLEL_RENDERING
@ QGIS_SERVER_PARALLEL_RENDERING
Definition: qgsserversettings.h:54
QgsServerSettingsEnv::QGIS_SERVER_WMS_MAX_HEIGHT
@ QGIS_SERVER_WMS_MAX_HEIGHT
Maximum height for a WMS request. The most conservative between this and the project one is used (sin...
Definition: qgsserversettings.h:66
QgsServerSettings::parallelRendering
bool parallelRendering() const
Returns parallel rendering setting.
Definition: qgsserversettings.cpp:417
QgsServerSettings::cacheSize
qint64 cacheSize() const
Returns the cache size.
Definition: qgsserversettings.cpp:452
QgsServerSettingsEnv::QGIS_SERVER_API_RESOURCES_DIRECTORY
@ QGIS_SERVER_API_RESOURCES_DIRECTORY
Base directory where HTML templates and static assets (e.g. images, js and css files) are searched fo...
Definition: qgsserversettings.h:68
QgsServerSettingsEnv::QGIS_SERVER_LANDING_PAGE_PROJECTS_PG_CONNECTIONS
@ QGIS_SERVER_LANDING_PAGE_PROJECTS_PG_CONNECTIONS
PostgreSQL connection strings used by the landing page service to find projects (since QGIS 3....
Definition: qgsserversettings.h:73
QgsServerSettingsEnv::QGIS_SERVER_LOG_STDERR
@ QGIS_SERVER_LOG_STDERR
Definition: qgsserversettings.h:58
QgsServerSettingsEnv::INI_FILE
@ INI_FILE
Definition: qgsserversettings.h:46
QgsServerSettings::name
static QString name(QgsServerSettingsEnv::EnvVar env)
Returns the string representation of a setting.
Definition: qgsserversettings.cpp:384
QgsApplication::pkgDataPath
static QString pkgDataPath()
Returns the common root path of all application data directories.
Definition: qgsapplication.cpp:578
QgsServerSettingsEnv::QGIS_SERVER_API_WFS3_MAX_LIMIT
@ QGIS_SERVER_API_WFS3_MAX_LIMIT
Maximum value for "limit" in a features request, defaults to 10000 (since QGIS 3.10).
Definition: qgsserversettings.h:69
QgsServerSettingsEnv::QGIS_SERVER_OVERRIDE_SYSTEM_LOCALE
@ QGIS_SERVER_OVERRIDE_SYSTEM_LOCALE
Override system locale (since QGIS 3.8)
Definition: qgsserversettings.h:65
QgsServerSettings::ignoreBadLayers
bool ignoreBadLayers() const
Returns true if the bad layers are ignored and false when the presence of a bad layers invalidates th...
Definition: qgsserversettings.cpp:502
QgsServerSettings::overrideSystemLocale
QString overrideSystemLocale() const
Overrides system locale.
Definition: qgsserversettings.cpp:462
QgsServerSettingsEnv::QGIS_SERVER_MAX_THREADS
@ QGIS_SERVER_MAX_THREADS
Definition: qgsserversettings.h:55
Qgis::MessageLevel
MessageLevel
Level for messages This will be used both for message log and message bar in application.
Definition: qgis.h:89
QgsServerSettingsEnv::QGIS_OPTIONS_PATH
@ QGIS_OPTIONS_PATH
Definition: qgsserversettings.h:53
QgsServerSettings::logSummary
void logSummary() const
Log a summary of settings currently loaded.
Definition: qgsserversettings.cpp:390
QgsServerSettings::maxThreads
int maxThreads() const
Returns the maximum number of threads to use.
Definition: qgsserversettings.cpp:422
QgsServerSettings::logStderr
bool logStderr() const
Returns whether logging to stderr is activated.
Definition: qgsserversettings.cpp:432
QgsServerSettings::wmsMaxHeight
int wmsMaxHeight() const
Returns the server-wide max height of a WMS GetMap request.
Definition: qgsserversettings.cpp:472
QgsMessageLog::logMessage
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
Definition: qgsmessagelog.cpp:27
QgsServerSettings::apiResourcesDirectory
QString apiResourcesDirectory() const
Returns the server-wide base directory where HTML templates and static assets (e.g.
Definition: qgsserversettings.cpp:492
QgsServerSettingsEnv::QGIS_SERVER_LANDING_PAGE_PROJECTS_DIRECTORIES
@ QGIS_SERVER_LANDING_PAGE_PROJECTS_DIRECTORIES
Directories used by the landing page service to find .qgs and .qgz projects (since QGIS 3....
Definition: qgsserversettings.h:72
QgsServerSettings::Setting
Definition: qgsserversettings.h:88
QgsServerSettingsEnv::QGIS_SERVER_LOG_FILE
@ QGIS_SERVER_LOG_FILE
Definition: qgsserversettings.h:57
QgsServerSettingsEnv::QGIS_SERVER_WMS_MAX_WIDTH
@ QGIS_SERVER_WMS_MAX_WIDTH
Maximum width for a WMS request. The most conservative between this and the project one is used (sinc...
Definition: qgsserversettings.h:67
QgsServerSettings::logLevel
Qgis::MessageLevel logLevel() const
Returns the log level.
Definition: qgsserversettings.cpp:437
QgsServerSettingsEnv::QGIS_PROJECT_FILE
@ QGIS_PROJECT_FILE
Definition: qgsserversettings.h:59
QgsServerSettingsEnv::EnvVar
EnvVar
Environment variables to configure the server.
Definition: qgsserversettings.h:52
QgsServerSettingsEnv::QGIS_SERVER_IGNORE_BAD_LAYERS
@ QGIS_SERVER_IGNORE_BAD_LAYERS
Do not consider the whole project unavailable if it contains bad layers.
Definition: qgsserversettings.h:61
Qgis::None
@ None
Definition: qgis.h:94
QgsServerSettings::load
void load()
Load settings according to current environment variables.
Definition: qgsserversettings.cpp:270
QgsServerSettingsEnv::QGIS_SERVER_SHOW_GROUP_SEPARATOR
@ QGIS_SERVER_SHOW_GROUP_SEPARATOR
Show group (thousands) separator when formatting numeric values, defaults to false (since QGIS 3....
Definition: qgsserversettings.h:64