QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
Classes | Public Member Functions | Static Public Member Functions | List of all members
QgsServerSettings Class Reference

Provides a way to retrieve settings by prioritizing according to environment variables, ini file and default values. More...

#include <qgsserversettings.h>

Classes

struct  Setting
 

Public Member Functions

 QgsServerSettings ()
 Constructor. More...
 
QString apiResourcesDirectory () const
 Returns the server-wide base directory where HTML templates and static assets (e.g. More...
 
qlonglong apiWfs3MaxLimit () const
 Returns the server-wide maximum allowed value for "limit" in a features request. More...
 
QString cacheDirectory () const
 Returns the cache directory. More...
 
qint64 cacheSize () const
 Returns the cache size. More...
 
bool getPrintDisabled () const
 Returns true if WMS GetPrint request is disabled and the project's reading flag QgsProject::ReadFlag::FlagDontLoadLayouts is activated. More...
 
bool ignoreBadLayers () const
 Returns true if the bad layers are ignored and false when the presence of a bad layers invalidates the whole project making it unavailable. More...
 
QString iniFile () const
 Returns the ini file loaded by QSetting. More...
 
QString landingPageBaseUrlPrefix () const
 Returns the landing page base URL regular expression, defaults to /. More...
 
QString landingPageProjectsDirectories () const
 Returns the directories used by the landing page service to find .qgs and .qgz projects. More...
 
QString landingPageProjectsPgConnections () const
 Returns the PostgreSQL connection strings used by the landing page service to find projects. More...
 
void load ()
 Load settings according to current environment variables. More...
 
bool load (const QString &envVarName)
 Load setting for a specific environment variable name. More...
 
QString logFile () const
 Returns the log file. More...
 
Qgis::MessageLevel logLevel () const
 Returns the log level. More...
 
bool logProfile () const
 Returns true if profile information has to be added to the logs, default value is false. More...
 
bool logStderr () const
 Returns whether logging to stderr is activated. More...
 
void logSummary () const
 Log a summary of settings currently loaded. More...
 
int maxThreads () const
 Returns the maximum number of threads to use. More...
 
QString overrideSystemLocale () const
 Overrides system locale. More...
 
bool parallelRendering () const
 Returns parallel rendering setting. More...
 
int projectCacheCheckInterval () const
 Returns the config cache check interval for the 'periodic' strategy. More...
 
QString projectCacheStrategy () const
 Returns the project's cache strategy The default value is 'filesystem', the value can be changed by setting the environment variable QGIS_SERVER_PROJECT_CACHE_STRATEGY. More...
 
QString projectFile () const
 Returns the QGS project file to use. More...
 
QString serviceUrl (const QString &service) const
 Returns the service URL from the setting. More...
 
bool showGroupSeparator () const
 Show group (thousand) separator. More...
 
bool trustLayerMetadata () const
 Returns true if the reading flag trust layer metadata is activated. More...
 
int wmsMaxHeight () const
 Returns the server-wide max height of a WMS GetMap request. More...
 
int wmsMaxWidth () const
 Returns the server-wide max width of a WMS GetMap request. More...
 

Static Public Member Functions

static QString name (QgsServerSettingsEnv::EnvVar env)
 Returns the string representation of a setting. More...
 

Detailed Description

Provides a way to retrieve settings by prioritizing according to environment variables, ini file and default values.

Since
QGIS 3.0

Definition at line 92 of file qgsserversettings.h.

Constructor & Destructor Documentation

◆ QgsServerSettings()

QgsServerSettings::QgsServerSettings ( )

Constructor.

Definition at line 25 of file qgsserversettings.cpp.

Member Function Documentation

◆ apiResourcesDirectory()

QString QgsServerSettings::apiResourcesDirectory ( ) const

Returns the server-wide base directory where HTML templates and static assets (e.g.

images, js and css files) are searched for.

The default path is calculated by joining QgsApplication::pkgDataPath() with "resources/server/api", this path can be changed by setting the environment variable QGIS_SERVER_API_RESOURCES_DIRECTORY.

Since
QGIS 3.10

Definition at line 584 of file qgsserversettings.cpp.

◆ apiWfs3MaxLimit()

qlonglong QgsServerSettings::apiWfs3MaxLimit ( ) const

Returns the server-wide maximum allowed value for "limit" in a features request.

The default value is 10000, this value can be changed by setting the environment variable QGIS_SERVER_API_WFS3_MAX_LIMIT.

Since
QGIS 3.10

Definition at line 589 of file qgsserversettings.cpp.

◆ cacheDirectory()

QString QgsServerSettings::cacheDirectory ( ) const

Returns the cache directory.

Returns
the directory.

Definition at line 544 of file qgsserversettings.cpp.

◆ cacheSize()

qint64 QgsServerSettings::cacheSize ( ) const

Returns the cache size.

Returns
the cache size.

Definition at line 539 of file qgsserversettings.cpp.

◆ getPrintDisabled()

bool QgsServerSettings::getPrintDisabled ( ) const

Returns true if WMS GetPrint request is disabled and the project's reading flag QgsProject::ReadFlag::FlagDontLoadLayouts is activated.

The default value is false, this value can be changed by setting the environment variable QGIS_SERVER_DISABLE_GETPRINT.

Since
QGIS 3.16

Definition at line 604 of file qgsserversettings.cpp.

◆ ignoreBadLayers()

bool QgsServerSettings::ignoreBadLayers ( ) const

Returns true if the bad layers are ignored and false when the presence of a bad layers invalidates the whole project making it unavailable.

The default value is true, this value can be changed by setting the environment variable QGIS_SERVER_IGNORE_BAD_LAYERS.

Since
QGIS 3.10.5

Definition at line 594 of file qgsserversettings.cpp.

◆ iniFile()

QString QgsServerSettings::iniFile ( ) const

Returns the ini file loaded by QSetting.

Returns
the path of the ini file or an empty string if none is loaded.

Definition at line 504 of file qgsserversettings.cpp.

◆ landingPageBaseUrlPrefix()

QString QgsServerSettings::landingPageBaseUrlPrefix ( ) const

Returns the landing page base URL regular expression, defaults to /.

Since
QGIS 3.20

Definition at line 579 of file qgsserversettings.cpp.

◆ landingPageProjectsDirectories()

QString QgsServerSettings::landingPageProjectsDirectories ( ) const

Returns the directories used by the landing page service to find .qgs and .qgz projects.

Multiple directories can be specified by separating them with '||'.

Since
QGIS 3.16

Definition at line 569 of file qgsserversettings.cpp.

◆ landingPageProjectsPgConnections()

QString QgsServerSettings::landingPageProjectsPgConnections ( ) const

Returns the PostgreSQL connection strings used by the landing page service to find projects.

Multiple connections can be specified by separating them with '||'.

Since
QGIS 3.16

Definition at line 574 of file qgsserversettings.cpp.

◆ load() [1/2]

void QgsServerSettings::load ( )

Load settings according to current environment variables.

Definition at line 361 of file qgsserversettings.cpp.

◆ load() [2/2]

bool QgsServerSettings::load ( const QString &  envVarName)

Load setting for a specific environment variable name.

Returns
true if loading is successful, false in case of an invalid name.

Definition at line 377 of file qgsserversettings.cpp.

◆ logFile()

QString QgsServerSettings::logFile ( ) const

Returns the log file.

Returns
the path of the log file or an empty string if none is defined.

Definition at line 519 of file qgsserversettings.cpp.

◆ logLevel()

Qgis::MessageLevel QgsServerSettings::logLevel ( ) const

Returns the log level.

Returns
the log level.

Definition at line 529 of file qgsserversettings.cpp.

◆ logProfile()

bool QgsServerSettings::logProfile ( ) const

Returns true if profile information has to be added to the logs, default value is false.

Note
this flag is only effective when logLevel() returns Qgis::MessageLevel::Info (0)
See also
logLevel()
Since
QGIS 3.18

Definition at line 609 of file qgsserversettings.cpp.

◆ logStderr()

bool QgsServerSettings::logStderr ( ) const

Returns whether logging to stderr is activated.

Returns
true if logging to stderr is activated, false otherwise.
Since
QGIS 3.4

Definition at line 524 of file qgsserversettings.cpp.

◆ logSummary()

void QgsServerSettings::logSummary ( ) const

Log a summary of settings currently loaded.

Definition at line 482 of file qgsserversettings.cpp.

◆ maxThreads()

int QgsServerSettings::maxThreads ( ) const

Returns the maximum number of threads to use.

Returns
the number of threads.

Definition at line 514 of file qgsserversettings.cpp.

◆ name()

QString QgsServerSettings::name ( QgsServerSettingsEnv::EnvVar  env)
static

Returns the string representation of a setting.

Since
QGIS 3.16

Definition at line 476 of file qgsserversettings.cpp.

◆ overrideSystemLocale()

QString QgsServerSettings::overrideSystemLocale ( ) const

Overrides system locale.

Returns
the optional override for system locale.
Since
QGIS 3.8

Definition at line 549 of file qgsserversettings.cpp.

◆ parallelRendering()

bool QgsServerSettings::parallelRendering ( ) const

Returns parallel rendering setting.

Returns
true if parallel rendering is activated, false otherwise.

Definition at line 509 of file qgsserversettings.cpp.

◆ projectCacheCheckInterval()

int QgsServerSettings::projectCacheCheckInterval ( ) const

Returns the config cache check interval for the 'periodic' strategy.

Since
QGIS 3.26

Definition at line 642 of file qgsserversettings.cpp.

◆ projectCacheStrategy()

QString QgsServerSettings::projectCacheStrategy ( ) const

Returns the project's cache strategy The default value is 'filesystem', the value can be changed by setting the environment variable QGIS_SERVER_PROJECT_CACHE_STRATEGY.

Possible values are:

  • 'filesystem': Use file system watcher for notifying projects change. Note that it works only with projects stored in files and not across mounted NFS volumes on Linux.
  • 'periodic': Timer based periodic check for project's changes. Works with all storage backend.
  • 'off': Disable completely internal project's cache handling
Since
QGIS 3.26

Definition at line 647 of file qgsserversettings.cpp.

◆ projectFile()

QString QgsServerSettings::projectFile ( ) const

Returns the QGS project file to use.

Returns
the path of the QGS project or an empty string if none is defined.

Definition at line 534 of file qgsserversettings.cpp.

◆ serviceUrl()

QString QgsServerSettings::serviceUrl ( const QString &  service) const

Returns the service URL from the setting.

Since
QGIS 3.20

Definition at line 614 of file qgsserversettings.cpp.

◆ showGroupSeparator()

bool QgsServerSettings::showGroupSeparator ( ) const

Show group (thousand) separator.

Returns
if group separator must be shown, default to false.
Since
QGIS 3.8

Definition at line 554 of file qgsserversettings.cpp.

◆ trustLayerMetadata()

bool QgsServerSettings::trustLayerMetadata ( ) const

Returns true if the reading flag trust layer metadata is activated.

The default value is false, this value can be changed by setting the environment variable QGIS_SERVER_TRUST_LAYER_METADATA.

Since
QGIS 3.16

Definition at line 599 of file qgsserversettings.cpp.

◆ wmsMaxHeight()

int QgsServerSettings::wmsMaxHeight ( ) const

Returns the server-wide max height of a WMS GetMap request.

The lower one of this and the project configuration is used.

Returns
the max height of a WMS GetMap request.
Since
QGIS 3.6.2

Definition at line 559 of file qgsserversettings.cpp.

◆ wmsMaxWidth()

int QgsServerSettings::wmsMaxWidth ( ) const

Returns the server-wide max width of a WMS GetMap request.

The lower one of this and the project configuration is used.

Returns
the max width of a WMS GetMap request.
Since
QGIS 3.6.2

Definition at line 564 of file qgsserversettings.cpp.


The documentation for this class was generated from the following files: