QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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::fromValue( Qgis::MessageLevel::NoLevel ),
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  // cache directory
112  const Setting sCacheDir = { QgsServerSettingsEnv::QGIS_SERVER_CACHE_DIRECTORY,
114  QStringLiteral( "Specify the cache directory" ),
115  QStringLiteral( "/cache/directory" ),
116  QVariant::String,
117  QVariant( QgsApplication::qgisSettingsDirPath() + "cache" ),
118  QVariant()
119  };
120  mSettings[ sCacheDir.envVar ] = sCacheDir;
121 
122  // cache size
123  const Setting sCacheSize = { QgsServerSettingsEnv::QGIS_SERVER_CACHE_SIZE,
125  QStringLiteral( "Specify the cache size" ),
126  QStringLiteral( "/cache/size" ),
127  QVariant::LongLong,
128  QVariant( 256 * 1024 * 1024 ),
129  QVariant()
130  };
131  mSettings[ sCacheSize.envVar ] = sCacheSize;
132 
133  // system locale override
134  const Setting sOverrideSystemLocale = { QgsServerSettingsEnv::QGIS_SERVER_OVERRIDE_SYSTEM_LOCALE,
136  QStringLiteral( "Override system locale" ),
137  QStringLiteral( "/locale/userLocale" ),
138  QVariant::String,
139  QVariant( "" ),
140  QVariant()
141  };
142  mSettings[ sOverrideSystemLocale.envVar ] = sOverrideSystemLocale;
143 
144  // bad layers handling
145  const Setting sIgnoreBadLayers = { QgsServerSettingsEnv::QGIS_SERVER_IGNORE_BAD_LAYERS,
147  QStringLiteral( "Ignore bad layers" ),
148  QString(),
149  QVariant::Bool,
150  QVariant( false ),
151  QVariant()
152  };
153  mSettings[ sIgnoreBadLayers.envVar ] = sIgnoreBadLayers;
154 
155  // trust layer metadata
156  const Setting sTrustLayerMetadata = { QgsServerSettingsEnv::QGIS_SERVER_TRUST_LAYER_METADATA,
158  QStringLiteral( "Trust layer metadata" ),
159  QString(),
160  QVariant::Bool,
161  QVariant( false ),
162  QVariant()
163  };
164  mSettings[ sTrustLayerMetadata.envVar ] = sTrustLayerMetadata;
165 
166  // don't load layouts
167  const Setting sDontLoadLayouts = { QgsServerSettingsEnv::QGIS_SERVER_DISABLE_GETPRINT,
169  QStringLiteral( "Don't load layouts" ),
170  QString(),
171  QVariant::Bool,
172  QVariant( false ),
173  QVariant()
174  };
175  mSettings[ sDontLoadLayouts.envVar ] = sDontLoadLayouts;
176 
177  // show group separator
178  const Setting sShowGroupSeparator = { QgsServerSettingsEnv::QGIS_SERVER_SHOW_GROUP_SEPARATOR,
180  QStringLiteral( "Show group (thousands) separator" ),
181  QStringLiteral( "/locale/showGroupSeparator" ),
182  QVariant::String,
183  QVariant( false ),
184  QVariant()
185  };
186  mSettings[ sShowGroupSeparator.envVar ] = sShowGroupSeparator;
187 
188  // max height
189  const Setting sMaxHeight = { QgsServerSettingsEnv::QGIS_SERVER_WMS_MAX_HEIGHT,
191  QStringLiteral( "Maximum height for a WMS request. The lower one of this and the project configuration is used." ),
192  QStringLiteral( "/qgis/max_wms_height" ),
193  QVariant::LongLong,
194  QVariant( -1 ),
195  QVariant()
196  };
197  mSettings[ sMaxHeight.envVar ] = sMaxHeight;
198 
199  // max width
200  const Setting sMaxWidth = { QgsServerSettingsEnv::QGIS_SERVER_WMS_MAX_WIDTH,
202  QStringLiteral( "Maximum width for a WMS request. The most conservative between this and the project one is used" ),
203  QStringLiteral( "/qgis/max_wms_width" ),
204  QVariant::LongLong,
205  QVariant( -1 ),
206  QVariant()
207  };
208  mSettings[ sMaxWidth.envVar ] = sMaxWidth;
209 
210  // API templates and static override directory
211  const Setting sApiResourcesDirectory = { QgsServerSettingsEnv::QGIS_SERVER_API_RESOURCES_DIRECTORY,
213  QStringLiteral( "Base directory where HTML templates and static assets (e.g. images, js and css files) are searched for" ),
214  QStringLiteral( "/qgis/server_api_resources_directory" ),
215  QVariant::String,
216  QDir( QgsApplication::pkgDataPath() ).absoluteFilePath( QStringLiteral( "resources/server/api" ) ),
217  QString()
218  };
219 
220  mSettings[ sApiResourcesDirectory.envVar ] = sApiResourcesDirectory;
221 
222  // API WFS3 max limit
223  const Setting sApiWfs3MaxLimit = { QgsServerSettingsEnv::QGIS_SERVER_API_WFS3_MAX_LIMIT,
225  QStringLiteral( "Maximum value for \"limit\" in a features request, defaults to 10000" ),
226  QStringLiteral( "/qgis/server_api_wfs3_max_limit" ),
227  QVariant::LongLong,
228  QVariant( 10000 ),
229  QVariant()
230  };
231 
232  mSettings[ sApiWfs3MaxLimit.envVar ] = sApiWfs3MaxLimit;
233 
234  // projects directory for landing page service
235  const Setting sProjectsDirectories = { QgsServerSettingsEnv::QGIS_SERVER_LANDING_PAGE_PROJECTS_DIRECTORIES,
237  QStringLiteral( "Directories used by the landing page service to find .qgs and .qgz projects" ),
238  QStringLiteral( "/qgis/server_projects_directories" ),
239  QVariant::String,
240  QVariant( "" ),
241  QVariant()
242  };
243 
244  mSettings[ sProjectsDirectories.envVar ] = sProjectsDirectories;
245 
246  // postgresql connection string for landing page service
247  const Setting sProjectsPgConnections = { QgsServerSettingsEnv::QGIS_SERVER_LANDING_PAGE_PROJECTS_PG_CONNECTIONS,
249  QStringLiteral( "PostgreSQL connection strings used by the landing page service to find projects" ),
250  QStringLiteral( "/qgis/server_projects_pg_connections" ),
251  QVariant::String,
252  QVariant( "" ),
253  QVariant()
254  };
255 
256  mSettings[ sProjectsPgConnections.envVar ] = sProjectsPgConnections;
257 
258  // landing page base URL prefix
259  const Setting sLandingPageBaseUrlPrefix = { QgsServerSettingsEnv::QGIS_SERVER_LANDING_PAGE_PREFIX,
261  QStringLiteral( "Landing page base URL path prefix" ),
262  QStringLiteral( "/qgis/server_landing_page_base_url_prefix" ),
263  QVariant::String,
264  QVariant( "" ),
265  QVariant()
266  };
267 
268  mSettings[ sLandingPageBaseUrlPrefix.envVar ] = sLandingPageBaseUrlPrefix;
269 
270  // log profile
271  const Setting sLogProfile = { QgsServerSettingsEnv::QGIS_SERVER_LOG_PROFILE,
273  QStringLiteral( "Add detailed profile information to the logs, only effective when QGIS_SERVER_LOG_LEVEL=0" ),
274  QStringLiteral( "/qgis/server_log_profile" ),
275  QVariant::Bool,
276  QVariant( false ),
277  QVariant()
278  };
279 
280  mSettings[ sLogProfile.envVar ] = sLogProfile;
281 
282  // the default service URL.
283  const Setting sServiceUrl = { QgsServerSettingsEnv::QGIS_SERVER_SERVICE_URL,
285  QStringLiteral( "The default service URL" ),
286  QStringLiteral( "/qgis/server_service_url" ),
287  QVariant::String,
288  QVariant( "" ),
289  QVariant()
290  };
291  mSettings[ sServiceUrl.envVar ] = sServiceUrl;
292 
293  // the default WMS service URL.
294  const Setting sWmsServiceUrl = { QgsServerSettingsEnv::QGIS_SERVER_WMS_SERVICE_URL,
296  QStringLiteral( "The default WMS service URL" ),
297  QStringLiteral( "/qgis/server_wms_service_url" ),
298  QVariant::String,
299  QVariant( "" ),
300  QVariant()
301  };
302  mSettings[ sServiceUrl.envVar ] = sWmsServiceUrl;
303 
304  // the default WFS service URL.
305  const Setting sWfsServiceUrl = { QgsServerSettingsEnv::QGIS_SERVER_WFS_SERVICE_URL,
307  QStringLiteral( "The default WFS service URL" ),
308  QStringLiteral( "/qgis/server_wfs_service_url" ),
309  QVariant::String,
310  QVariant( "" ),
311  QVariant()
312  };
313  mSettings[ sServiceUrl.envVar ] = sWfsServiceUrl;
314 
315  // the default WCS service URL.
316  const Setting sWcsServiceUrl = { QgsServerSettingsEnv::QGIS_SERVER_WCS_SERVICE_URL,
318  QStringLiteral( "The default WcS service URL" ),
319  QStringLiteral( "/qgis/server_wcs_service_url" ),
320  QVariant::String,
321  QVariant( "" ),
322  QVariant()
323  };
324  mSettings[ sServiceUrl.envVar ] = sWfsServiceUrl;
325 
326  // the default WMTS service URL.
327  const Setting sWmtsServiceUrl = { QgsServerSettingsEnv::QGIS_SERVER_WMTS_SERVICE_URL,
329  QStringLiteral( "The default WMTS service URL" ),
330  QStringLiteral( "/qgis/server_wmts_service_url" ),
331  QVariant::String,
332  QVariant( "" ),
333  QVariant()
334  };
335  mSettings[ sServiceUrl.envVar ] = sWmtsServiceUrl;
336 
337  // the default config cache check interval
338  const Setting sConfigCacheCheckInterval = { QgsServerSettingsEnv::QGIS_SERVER_PROJECT_CACHE_CHECK_INTERVAL,
340  QStringLiteral( "The default project cache check interval" ),
341  QStringLiteral( "/qgis/server_project_cache_check_interval" ),
342  QVariant::Int,
343  QVariant( 0 ),
344  QVariant()
345  };
346  mSettings[ sConfigCacheCheckInterval.envVar ] = sConfigCacheCheckInterval;
347 
348  // the default config cache strategy
349  const Setting sProjectCacheStrategy = { QgsServerSettingsEnv::QGIS_SERVER_PROJECT_CACHE_STRATEGY,
351  QStringLiteral( "Project's cache strategy. Possible values are 'off','filesystem' or 'periodic'" ),
352  QStringLiteral( "/qgis/server_project_cache_strategy" ),
353  QVariant::String,
354  QVariant( "" ),
355  QVariant()
356  };
357  mSettings[ sProjectCacheStrategy.envVar ] = sProjectCacheStrategy;
358 
359 }
360 
362 {
363  // init settings each time to take into account QgsApplication and
364  // QCoreApplication configuration for some default values
365  initSettings();
366 
367  // store environment variables
368  QMap<QgsServerSettingsEnv::EnvVar, QString> env = getEnv();
369 
370  // load QSettings if QGIS_OPTIONS_PATH is defined
371  loadQSettings( env[ QgsServerSettingsEnv::QGIS_OPTIONS_PATH ] );
372 
373  // prioritize values: 'env var' -> 'ini file' -> 'default value'
374  prioritize( env );
375 }
376 
377 bool QgsServerSettings::load( const QString &envVarName )
378 {
379  bool rc( false );
380  const QMetaEnum metaEnum( QMetaEnum::fromType<QgsServerSettingsEnv::EnvVar>() );
381  const int value = metaEnum.keyToValue( envVarName.toStdString().c_str() );
382 
383  if ( value >= 0 )
384  {
385  const QString envValue( getenv( envVarName.toStdString().c_str() ) );
386  prioritize( QMap<QgsServerSettingsEnv::EnvVar, QString> { {( QgsServerSettingsEnv::EnvVar ) value, envValue } } );
387  rc = true;
388  }
389 
390  return rc;
391 }
392 
393 QMap<QgsServerSettingsEnv::EnvVar, QString> QgsServerSettings::getEnv() const
394 {
395  QMap<QgsServerSettingsEnv::EnvVar, QString> env;
396 
397  const QMetaEnum metaEnum( QMetaEnum::fromType<QgsServerSettingsEnv::EnvVar>() );
398  for ( int i = 0; i < metaEnum.keyCount(); i++ )
399  {
400  env[( QgsServerSettingsEnv::EnvVar ) metaEnum.value( i )] = getenv( metaEnum.key( i ) );
401  }
402 
403  return env;
404 }
405 
406 QVariant QgsServerSettings::value( QgsServerSettingsEnv::EnvVar envVar, bool actual ) const
407 {
408  if ( actual )
409  {
410  const QString envValue( getenv( name( envVar ).toStdString().c_str() ) );
411 
412  if ( ! envValue.isEmpty() )
413  return envValue;
414  }
415 
416  if ( mSettings[ envVar ].src == QgsServerSettingsEnv::DEFAULT_VALUE )
417  {
418  return mSettings[ envVar ].defaultVal;
419  }
420  else
421  {
422  return mSettings[ envVar ].val;
423  }
424 }
425 
426 void QgsServerSettings::loadQSettings( const QString &envOptPath ) const
427 {
428  if ( ! envOptPath.isEmpty() )
429  {
430  QSettings::setDefaultFormat( QSettings::IniFormat );
431  QSettings::setPath( QSettings::IniFormat, QSettings::UserScope, envOptPath );
432  }
433 }
434 
435 void QgsServerSettings::prioritize( const QMap<QgsServerSettingsEnv::EnvVar, QString> &env )
436 {
437  const auto constKeys( env.keys() );
438  for ( const QgsServerSettingsEnv::EnvVar &e : constKeys )
439  {
440  Setting s = mSettings[ e ];
441 
442  QVariant varValue;
443  if ( ! env.value( e ).isEmpty() )
444  {
445  varValue.setValue( env.value( e ) );
446  }
447 
448  if ( ! varValue.isNull() && varValue.canConvert( s.type ) )
449  {
450  s.val = varValue;
452  }
453  else if ( ! s.iniKey.isEmpty() && QSettings().contains( s.iniKey ) && QSettings().value( s.iniKey ).canConvert( s.type ) )
454  {
455  s.val = QSettings().value( s.iniKey );
457  }
458  else
459  {
460  s.val = QVariant();
462  }
463 
464  // an empty string can be returned from QSettings. In this case, we want
465  // to use the default value
466  if ( s.type == QVariant::String && s.val.toString().isEmpty() )
467  {
468  s.val = QVariant();
470  }
471 
472  mSettings[ e ] = s;
473  }
474 }
475 
477 {
478  const QMetaEnum metaEnumEnv( QMetaEnum::fromType<QgsServerSettingsEnv::EnvVar>() );
479  return metaEnumEnv.valueToKey( env );
480 }
481 
483 {
484  const QMetaEnum metaEnumSrc( QMetaEnum::fromType<QgsServerSettingsEnv::Source>() );
485 
486  QgsMessageLog::logMessage( "QGIS Server Settings: ", "Server", Qgis::MessageLevel::Info );
487  for ( const Setting &s : std::as_const( mSettings ) )
488  {
489  const QString src = metaEnumSrc.valueToKey( s.src );
490  const QString var = name( s.envVar );
491 
492  const QString msg = " - " + var + " / '" + s.iniKey + "' (" + s.descr + "): '" + value( s.envVar ).toString() + "' (read from " + src + ")";
493  QgsMessageLog::logMessage( msg, "Server", Qgis::MessageLevel::Info );
494  }
495 
496  if ( ! iniFile().isEmpty() )
497  {
498  const QString msg = "Ini file used to initialize settings: " + iniFile();
499  QgsMessageLog::logMessage( msg, "Server", Qgis::MessageLevel::Info );
500  }
501 }
502 
503 // getter
505 {
506  return QSettings().fileName();
507 }
508 
510 {
512 }
513 
515 {
516  return value( QgsServerSettingsEnv::QGIS_SERVER_MAX_THREADS ).toInt();
517 }
518 
520 {
521  return value( QgsServerSettingsEnv::QGIS_SERVER_LOG_FILE ).toString();
522 }
523 
525 {
526  return value( QgsServerSettingsEnv::QGIS_SERVER_LOG_STDERR ).toBool();
527 }
528 
530 {
531  return static_cast<Qgis::MessageLevel>( value( QgsServerSettingsEnv::QGIS_SERVER_LOG_LEVEL ).toInt() );
532 }
533 
535 {
536  return value( QgsServerSettingsEnv::QGIS_PROJECT_FILE ).toString();
537 }
538 
540 {
541  return value( QgsServerSettingsEnv::QGIS_SERVER_CACHE_SIZE ).toLongLong();
542 }
543 
545 {
546  return value( QgsServerSettingsEnv::QGIS_SERVER_CACHE_DIRECTORY ).toString();
547 }
548 
550 {
552 }
553 
555 {
557 }
558 
560 {
561  return value( QgsServerSettingsEnv::QGIS_SERVER_WMS_MAX_HEIGHT ).toInt();
562 }
563 
565 {
566  return value( QgsServerSettingsEnv::QGIS_SERVER_WMS_MAX_WIDTH ).toInt();
567 }
568 
570 {
572 }
573 
575 {
577 }
578 
580 {
581  return value( QgsServerSettingsEnv::QGIS_SERVER_LANDING_PAGE_PREFIX, true ).toString();
582 }
583 
585 {
587 }
588 
590 {
591  return value( QgsServerSettingsEnv::QGIS_SERVER_API_WFS3_MAX_LIMIT ).toLongLong();
592 }
593 
595 {
597 }
598 
600 {
602 }
603 
605 {
607 }
608 
610 {
611  return value( QgsServerSettingsEnv::QGIS_SERVER_LOG_PROFILE, false ).toBool();
612 }
613 
614 QString QgsServerSettings::serviceUrl( const QString &service ) const
615 {
616  QString result;
617  if ( service.compare( QLatin1String( "WMS" ) ) )
618  {
619  result = value( QgsServerSettingsEnv::QGIS_SERVER_WMS_SERVICE_URL ).toString();
620  }
621  else if ( service.compare( QLatin1String( "WFS" ) ) )
622  {
623  result = value( QgsServerSettingsEnv::QGIS_SERVER_WFS_SERVICE_URL ).toString();
624  }
625  else if ( service.compare( QLatin1String( "WCS" ) ) )
626  {
627  result = value( QgsServerSettingsEnv::QGIS_SERVER_WCS_SERVICE_URL ).toString();
628  }
629  else if ( service.compare( QLatin1String( "WMTS" ) ) )
630  {
631  result = value( QgsServerSettingsEnv::QGIS_SERVER_WMTS_SERVICE_URL ).toString();
632  }
633 
634  if ( result.isEmpty() )
635  {
636  result = value( QgsServerSettingsEnv::QGIS_SERVER_SERVICE_URL ).toString();
637  }
638 
639  return result;
640 }
641 
643 {
645 }
646 
648 {
649  QString result = value( QgsServerSettingsEnv::QGIS_SERVER_PROJECT_CACHE_STRATEGY ).toString();
650  if ( result.compare( QLatin1String( "filesystem" ) ) &&
651  result.compare( QLatin1String( "periodic" ) ) &&
652  result.compare( QLatin1String( "off" ) ) )
653  {
654  QgsMessageLog::logMessage( QStringLiteral( "Invalid cache strategy, expecting 'filesystem', 'periodic' or 'off'. Using 'filesystem' as default." ), "Server", Qgis::MessageLevel::Warning );
655  result = QStringLiteral( "filesystem" );
656  }
657  return result;
658 }
659 
QgsServerSettings::getPrintDisabled
bool getPrintDisabled() const
Returns true if WMS GetPrint request is disabled and the project's reading flag QgsProject::ReadFlag:...
Definition: qgsserversettings.cpp:604
QgsServerSettings::logProfile
bool logProfile() const
Returns true if profile information has to be added to the logs, default value is false.
Definition: qgsserversettings.cpp:609
qgsserversettings.h
QgsServerSettingsEnv::QGIS_SERVER_LOG_PROFILE
@ QGIS_SERVER_LOG_PROFILE
When QGIS_SERVER_LOG_LEVEL is 0 this flag adds to the logs detailed information about the time taken ...
Definition: qgsserversettings.h:73
QgsServerSettings::QgsServerSettings
QgsServerSettings()
Constructor.
Definition: qgsserversettings.cpp:25
QgsServerSettings::iniFile
QString iniFile() const
Returns the ini file loaded by QSetting.
Definition: qgsserversettings.cpp:504
QgsServerSettings::landingPageProjectsPgConnections
QString landingPageProjectsPgConnections() const
Returns the PostgreSQL connection strings used by the landing page service to find projects.
Definition: qgsserversettings.cpp:574
QgsServerSettings::wmsMaxWidth
int wmsMaxWidth() const
Returns the server-wide max width of a WMS GetMap request.
Definition: qgsserversettings.cpp:564
QgsServerSettingsEnv::QGIS_SERVER_WMS_SERVICE_URL
@ QGIS_SERVER_WMS_SERVICE_URL
To set the WMS service URL if it's not present in the project. (since QGIS 3.20).
Definition: qgsserversettings.h:75
QgsServerSettings::apiWfs3MaxLimit
qlonglong apiWfs3MaxLimit() const
Returns the server-wide maximum allowed value for "limit" in a features request.
Definition: qgsserversettings.cpp:589
QgsServerSettings::landingPageProjectsDirectories
QString landingPageProjectsDirectories() const
Returns the directories used by the landing page service to find .qgs and .qgz projects.
Definition: qgsserversettings.cpp:569
QgsServerSettingsEnv::QGIS_SERVER_CACHE_DIRECTORY
@ QGIS_SERVER_CACHE_DIRECTORY
Definition: qgsserversettings.h:61
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:544
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:70
QgsServerSettingsEnv::QGIS_SERVER_CACHE_SIZE
@ QGIS_SERVER_CACHE_SIZE
Definition: qgsserversettings.h:62
QgsServerSettings::projectCacheStrategy
QString projectCacheStrategy() const
Returns the project's cache strategy The default value is 'filesystem', the value can be changed by s...
Definition: qgsserversettings.cpp:647
QgsServerSettingsEnv::QGIS_SERVER_PROJECT_CACHE_CHECK_INTERVAL
@ QGIS_SERVER_PROJECT_CACHE_CHECK_INTERVAL
Prefix of the path component of the landing page base URL, default is empty (since QGIS 3....
Definition: qgsserversettings.h:80
QgsServerSettingsEnv::QGIS_SERVER_LOG_LEVEL
@ QGIS_SERVER_LOG_LEVEL
Definition: qgsserversettings.h:56
QgsServerSettingsEnv::QGIS_SERVER_WFS_SERVICE_URL
@ QGIS_SERVER_WFS_SERVICE_URL
To set the WFS service URL if it's not present in the project. (since QGIS 3.20).
Definition: qgsserversettings.h:76
qgsapplication.h
QgsServerSettings::trustLayerMetadata
bool trustLayerMetadata() const
Returns true if the reading flag trust layer metadata is activated.
Definition: qgsserversettings.cpp:599
QgsServerSettingsEnv::QGIS_SERVER_WCS_SERVICE_URL
@ QGIS_SERVER_WCS_SERVICE_URL
To set the WCS service URL if it's not present in the project. (since QGIS 3.20).
Definition: qgsserversettings.h:77
QgsApplication::qgisSettingsDirPath
static QString qgisSettingsDirPath()
Returns the path to the settings directory in user's home dir.
Definition: qgsapplication.cpp:1099
QgsServerSettings::showGroupSeparator
bool showGroupSeparator() const
Show group (thousand) separator.
Definition: qgsserversettings.cpp:554
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:69
QgsServerSettings::projectFile
QString projectFile() const
Returns the QGS project file to use.
Definition: qgsserversettings.cpp:534
QgsServerSettings::logFile
QString logFile() const
Returns the log file.
Definition: qgsserversettings.cpp:519
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:65
QgsServerSettings::parallelRendering
bool parallelRendering() const
Returns parallel rendering setting.
Definition: qgsserversettings.cpp:509
QgsServerSettings::cacheSize
qint64 cacheSize() const
Returns the cache size.
Definition: qgsserversettings.cpp:539
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:67
QgsServerSettingsEnv::QGIS_SERVER_PROJECT_CACHE_STRATEGY
@ QGIS_SERVER_PROJECT_CACHE_STRATEGY
Set the interval for cache invalidation strategy 'interval', default to 0 which select the legacy Fil...
Definition: qgsserversettings.h:81
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:72
QgsServerSettingsEnv::QGIS_SERVER_LOG_STDERR
@ QGIS_SERVER_LOG_STDERR
Definition: qgsserversettings.h:58
QgsServerSettingsEnv::INI_FILE
@ INI_FILE
Definition: qgsserversettings.h:46
QgsMessageLog::logMessage
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::MessageLevel::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
Definition: qgsmessagelog.cpp:27
QgsServerSettings::name
static QString name(QgsServerSettingsEnv::EnvVar env)
Returns the string representation of a setting.
Definition: qgsserversettings.cpp:476
QgsApplication::pkgDataPath
static QString pkgDataPath()
Returns the common root path of all application data directories.
Definition: qgsapplication.cpp:645
QgsServerSettingsEnv::QGIS_SERVER_WMTS_SERVICE_URL
@ QGIS_SERVER_WMTS_SERVICE_URL
To set the WMTS service URL if it's not present in the project. (since QGIS 3.20).
Definition: qgsserversettings.h:78
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:68
QgsServerSettingsEnv::QGIS_SERVER_OVERRIDE_SYSTEM_LOCALE
@ QGIS_SERVER_OVERRIDE_SYSTEM_LOCALE
Override system locale (since QGIS 3.8)
Definition: qgsserversettings.h:64
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:594
QgsServerSettings::landingPageBaseUrlPrefix
QString landingPageBaseUrlPrefix() const
Returns the landing page base URL regular expression, defaults to /.
Definition: qgsserversettings.cpp:579
QgsServerSettings::overrideSystemLocale
QString overrideSystemLocale() const
Overrides system locale.
Definition: qgsserversettings.cpp:549
QgsServerSettingsEnv::QGIS_SERVER_MAX_THREADS
@ QGIS_SERVER_MAX_THREADS
Definition: qgsserversettings.h:55
QgsServerSettings::serviceUrl
QString serviceUrl(const QString &service) const
Returns the service URL from the setting.
Definition: qgsserversettings.cpp:614
Qgis::MessageLevel
MessageLevel
Level for messages This will be used both for message log and message bar in application.
Definition: qgis.h:114
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:482
QgsServerSettings::maxThreads
int maxThreads() const
Returns the maximum number of threads to use.
Definition: qgsserversettings.cpp:514
QgsServerSettings::logStderr
bool logStderr() const
Returns whether logging to stderr is activated.
Definition: qgsserversettings.cpp:524
QgsServerSettings::wmsMaxHeight
int wmsMaxHeight() const
Returns the server-wide max height of a WMS GetMap request.
Definition: qgsserversettings.cpp:559
QgsServerSettings::apiResourcesDirectory
QString apiResourcesDirectory() const
Returns the server-wide base directory where HTML templates and static assets (e.g.
Definition: qgsserversettings.cpp:584
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:71
QgsServerSettings::Setting
Definition: qgsserversettings.h:95
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:66
QgsServerSettingsEnv::QGIS_SERVER_SERVICE_URL
@ QGIS_SERVER_SERVICE_URL
To set the service URL if it's not present in the project. (since QGIS 3.20).
Definition: qgsserversettings.h:74
QgsServerSettings::logLevel
Qgis::MessageLevel logLevel() const
Returns the log level.
Definition: qgsserversettings.cpp:529
QgsServerSettingsEnv::QGIS_PROJECT_FILE
@ QGIS_PROJECT_FILE
Definition: qgsserversettings.h:59
QgsServerSettingsEnv::EnvVar
EnvVar
Environment variables to configure the server.
Definition: qgsserversettings.h:51
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:60
QgsServerSettings::load
void load()
Load settings according to current environment variables.
Definition: qgsserversettings.cpp:361
QgsServerSettingsEnv::QGIS_SERVER_LANDING_PAGE_PREFIX
@ QGIS_SERVER_LANDING_PAGE_PREFIX
Definition: qgsserversettings.h:79
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:63
QgsServerSettings::projectCacheCheckInterval
int projectCacheCheckInterval() const
Returns the config cache check interval for the 'periodic' strategy.
Definition: qgsserversettings.cpp:642