QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgsserversettings.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsserversettings.h
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 
20 #ifndef QGSSERVERSETTINGS_H
21 #define QGSSERVERSETTINGS_H
22 
23 #include <QObject>
24 #include <QMetaEnum>
25 
26 #include "qgsmessagelog.h"
27 #include "qgis_server.h"
28 #include "qgis_sip.h"
29 
36 class SERVER_EXPORT QgsServerSettingsEnv : public QObject
37 {
38  Q_OBJECT
39 
40  public:
42  enum Source
43  {
46  INI_FILE
47  };
48  Q_ENUM( Source )
49 
50 
51  enum EnvVar
52  {
82  };
83  Q_ENUM( EnvVar )
84 };
85 
92 class SERVER_EXPORT QgsServerSettings
93 {
94  public:
96  {
99  QString descr;
100  QString iniKey;
101  QVariant::Type type;
102  QVariant defaultVal;
103  QVariant val;
104  };
105 
110 
114  void load();
115 
120  bool load( const QString &envVarName );
121 
125  void logSummary() const;
126 
131  QString iniFile() const;
132 
137  bool parallelRendering() const;
138 
143  int maxThreads() const;
144 
149  Qgis::MessageLevel logLevel() const;
150 
158  bool logProfile() const;
159 
164  QString projectFile() const;
165 
170  QString logFile() const;
171 
177  bool logStderr() const;
178 
183  qint64 cacheSize() const;
184 
189  QString cacheDirectory() const;
190 
196  QString overrideSystemLocale() const;
197 
203  bool showGroupSeparator() const;
204 
210  int wmsMaxHeight() const;
211 
217  int wmsMaxWidth() const;
218 
225  QString landingPageProjectsDirectories() const;
226 
233  QString landingPageProjectsPgConnections() const;
234 
239  QString landingPageBaseUrlPrefix() const;
240 
249  QString apiResourcesDirectory() const;
250 
259  qlonglong apiWfs3MaxLimit() const;
260 
270  bool ignoreBadLayers() const;
271 
280  bool trustLayerMetadata() const;
281 
291  bool getPrintDisabled() const;
292 
297  QString serviceUrl( const QString &service ) const;
298 
303  int projectCacheCheckInterval() const;
304 
318  QString projectCacheStrategy() const;
319 
324  static QString name( QgsServerSettingsEnv::EnvVar env );
325 
326  private:
327  void initSettings();
328  QVariant value( QgsServerSettingsEnv::EnvVar envVar, bool actual = false ) const;
329  QMap<QgsServerSettingsEnv::EnvVar, QString> getEnv() const;
330  void loadQSettings( const QString &envOptPath ) const;
331  void prioritize( const QMap<QgsServerSettingsEnv::EnvVar, QString> &env );
332 
333  QMap< QgsServerSettingsEnv::EnvVar, Setting > mSettings;
334 };
335 
336 #endif
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
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::Setting::val
QVariant val
Definition: qgsserversettings.h:103
QgsServerSettingsEnv::QGIS_SERVER_CACHE_DIRECTORY
@ QGIS_SERVER_CACHE_DIRECTORY
Definition: qgsserversettings.h:61
QgsServerSettingsEnv::Source
Source
Source of the parameter used in the configuration.
Definition: qgsserversettings.h:42
QgsServerSettingsEnv::ENVIRONMENT_VARIABLE
@ ENVIRONMENT_VARIABLE
Definition: qgsserversettings.h:45
QgsServerSettingsEnv::DEFAULT_VALUE
@ DEFAULT_VALUE
Definition: qgsserversettings.h:44
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
QgsServerSettingsEnv
Provides some enum describing the environment currently supported for configuration.
Definition: qgsserversettings.h:36
QgsServerSettings::Setting::descr
QString descr
Definition: qgsserversettings.h:99
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
QgsServerSettings
Provides a way to retrieve settings by prioritizing according to environment variables,...
Definition: qgsserversettings.h:92
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
SIP_SKIP
#define SIP_SKIP
Definition: qgis_sip.h:126
QgsServerProjectUtils::wmsMaxHeight
SERVER_EXPORT int wmsMaxHeight(const QgsProject &project)
Returns the maximum height for WMS images defined in a QGIS project.
Definition: qgsserverprojectutils.cpp:130
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
QgsServerSettingsEnv::QGIS_SERVER_PARALLEL_RENDERING
@ QGIS_SERVER_PARALLEL_RENDERING
Definition: qgsserversettings.h:54
QgsServerSettings::Setting::iniKey
QString iniKey
Definition: qgsserversettings.h:100
QgsServerSettings::Setting::type
QVariant::Type type
Definition: qgsserversettings.h:101
QgsServerSettings::Setting::defaultVal
QVariant defaultVal
Definition: qgsserversettings.h:102
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
QgsServerProjectUtils::serviceUrl
SERVER_EXPORT QString serviceUrl(const QString &service, const QgsServerRequest &request, const QgsServerSettings &settings)
Returns the service url defined in the environment variable or with HTTP header.
Definition: qgsserverprojectutils.cpp:318
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
qgis_sip.h
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::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
QgsServerProjectUtils::wmsMaxWidth
SERVER_EXPORT int wmsMaxWidth(const QgsProject &project)
Returns the maximum width for WMS images defined in a QGIS project.
Definition: qgsserverprojectutils.cpp:125
QgsServerSettingsEnv::QGIS_SERVER_OVERRIDE_SYSTEM_LOCALE
@ QGIS_SERVER_OVERRIDE_SYSTEM_LOCALE
Override system locale (since QGIS 3.8)
Definition: qgsserversettings.h:64
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:114
QgsServerSettingsEnv::QGIS_OPTIONS_PATH
@ QGIS_OPTIONS_PATH
Definition: qgsserversettings.h:53
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
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::Setting::envVar
QgsServerSettingsEnv::EnvVar envVar
Definition: qgsserversettings.h:97
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::Setting::src
QgsServerSettingsEnv::Source src
Definition: qgsserversettings.h:98
qgsmessagelog.h