QGIS API Documentation  3.20.0-Odense (decaadbb31)
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  {
80  };
81  Q_ENUM( EnvVar )
82 };
83 
90 class SERVER_EXPORT QgsServerSettings
91 {
92  public:
94  {
97  QString descr;
98  QString iniKey;
99  QVariant::Type type;
100  QVariant defaultVal;
101  QVariant val;
102  };
103 
108 
112  void load();
113 
118  bool load( const QString &envVarName );
119 
123  void logSummary() const;
124 
129  QString iniFile() const;
130 
135  bool parallelRendering() const;
136 
141  int maxThreads() const;
142 
147  Qgis::MessageLevel logLevel() const;
148 
156  bool logProfile();
157 
162  QString projectFile() const;
163 
168  QString logFile() const;
169 
175  bool logStderr() const;
176 
181  qint64 cacheSize() const;
182 
187  QString cacheDirectory() const;
188 
194  QString overrideSystemLocale() const;
195 
201  bool showGroupSeparator() const;
202 
208  int wmsMaxHeight() const;
209 
215  int wmsMaxWidth() const;
216 
223  QString landingPageProjectsDirectories() const;
224 
231  QString landingPageProjectsPgConnections() const;
232 
237  QString landingPageBaseUrlPrefix() const;
238 
247  QString apiResourcesDirectory() const;
248 
257  qlonglong apiWfs3MaxLimit() const;
258 
268  bool ignoreBadLayers() const;
269 
278  bool trustLayerMetadata() const;
279 
289  bool getPrintDisabled() const;
290 
295  QString serviceUrl( const QString &service ) const;
296 
301  static QString name( QgsServerSettingsEnv::EnvVar env );
302 
303  private:
304  void initSettings();
305  QVariant value( QgsServerSettingsEnv::EnvVar envVar, bool actual = false ) const;
306  QMap<QgsServerSettingsEnv::EnvVar, QString> getEnv() const;
307  void loadQSettings( const QString &envOptPath ) const;
308  void prioritize( const QMap<QgsServerSettingsEnv::EnvVar, QString> &env );
309 
310  QMap< QgsServerSettingsEnv::EnvVar, Setting > mSettings;
311 };
312 
313 #endif
MessageLevel
Level for messages This will be used both for message log and message bar in application.
Definition: qgis.h:105
Provides some enum describing the environment currently supported for configuration.
Source
Source of the parameter used in the configuration.
EnvVar
Environment variables to configure the server.
@ QGIS_SERVER_WCS_SERVICE_URL
To set the WCS service URL if it's not present in the project. (since QGIS 3.20).
@ QGIS_SERVER_WMTS_SERVICE_URL
To set the WMTS service URL if it's not present in the project. (since QGIS 3.20).
@ QGIS_SERVER_IGNORE_BAD_LAYERS
Do not consider the whole project unavailable if it contains bad layers.
@ QGIS_SERVER_TRUST_LAYER_METADATA
Trust layer metadata. Improves project read time. (since QGIS 3.16).
@ QGIS_SERVER_WFS_SERVICE_URL
To set the WFS service URL if it's not present in the project. (since QGIS 3.20).
@ QGIS_SERVER_OVERRIDE_SYSTEM_LOCALE
Override system locale (since QGIS 3.8)
@ QGIS_SERVER_LANDING_PAGE_PROJECTS_PG_CONNECTIONS
PostgreSQL connection strings used by the landing page service to find projects (since QGIS 3....
@ QGIS_SERVER_API_WFS3_MAX_LIMIT
Maximum value for "limit" in a features request, defaults to 10000 (since QGIS 3.10).
@ QGIS_SERVER_API_RESOURCES_DIRECTORY
Base directory where HTML templates and static assets (e.g. images, js and css files) are searched fo...
@ QGIS_SERVER_WMS_MAX_WIDTH
Maximum width for a WMS request. The most conservative between this and the project one is used (sinc...
@ QGIS_SERVER_WMS_MAX_HEIGHT
Maximum height for a WMS request. The most conservative between this and the project one is used (sin...
@ QGIS_SERVER_WMS_SERVICE_URL
To set the WMS service URL if it's not present in the project. (since QGIS 3.20).
@ QGIS_SERVER_DISABLE_GETPRINT
Disabled WMS GetPrint request and don't load layouts. Improves project read time. (since QGIS 3....
@ QGIS_SERVER_SHOW_GROUP_SEPARATOR
Show group (thousands) separator when formatting numeric values, defaults to false (since QGIS 3....
@ QGIS_SERVER_LANDING_PAGE_PROJECTS_DIRECTORIES
Directories used by the landing page service to find .qgs and .qgz projects (since QGIS 3....
@ QGIS_SERVER_LOG_PROFILE
When QGIS_SERVER_LOG_LEVEL is 0 this flag adds to the logs detailed information about the time taken ...
@ QGIS_SERVER_SERVICE_URL
To set the service URL if it's not present in the project. (since QGIS 3.20).
Provides a way to retrieve settings by prioritizing according to environment variables,...
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.
SERVER_EXPORT int wmsMaxWidth(const QgsProject &project)
Returns the maximum width for WMS images defined in a QGIS project.
SERVER_EXPORT int wmsMaxHeight(const QgsProject &project)
Returns the maximum height for WMS images defined in a QGIS project.
#define SIP_SKIP
Definition: qgis_sip.h:126
QgsServerSettingsEnv::EnvVar envVar
QgsServerSettingsEnv::Source src