QGIS API Documentation 3.99.0-Master (21b3aa880ba)
Loading...
Searching...
No Matches
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 "qgis_server.h"
24#include "qgis_sip.h"
25#include "qgsmessagelog.h"
26
27#include <QMetaEnum>
28#include <QObject>
29
35class SERVER_EXPORT QgsServerSettingsEnv : public QObject
36{
37 Q_OBJECT
38
39 public:
47 Q_ENUM( Source )
48
49
90 Q_ENUM( EnvVar )
91};
92
98class SERVER_EXPORT QgsServerSettings
99{
100 public:
111
116
120 void load();
121
126 bool load( const QString &envVarName );
127
131 void logSummary() const;
132
137 QString iniFile() const;
138
143 bool parallelRendering() const;
144
149 int maxThreads() const;
150
156
164 bool logProfile() const;
165
170 QString projectFile() const;
171
176 QString logFile() const;
177
183 bool logStderr() const;
184
189 qint64 cacheSize() const;
190
195 QString cacheDirectory() const;
196
202 QString overrideSystemLocale() const;
203
209 bool showGroupSeparator() const;
210
216 int wmsMaxHeight() const;
217
223 int wmsMaxWidth() const;
224
231 QString landingPageProjectsDirectories() const;
232
239 QString landingPageProjectsPgConnections() const;
240
245 QString landingPageBaseUrlPrefix() const;
246
255 QString apiResourcesDirectory() const;
256
265 qlonglong apiWfs3MaxLimit() const;
266
275 QString apiWfs3RootPath() const;
276
286 bool ignoreBadLayers() const;
287
292 bool ignoreRenderingErrors() const;
293
298 bool retryBadLayers() const;
299
308 bool trustLayerMetadata() const;
309
318 bool forceReadOnlyLayers() const;
319
329 bool getPrintDisabled() const;
330
335 QString serviceUrl( const QString &service ) const;
336
341 int projectCacheCheckInterval() const;
342
356 QString projectCacheStrategy() const;
357
365 int projectCacheSize() const;
366
375 QStringList allowedExtraSqlTokens() const;
376
385 QString applicationName() const;
386
391 static QString name( QgsServerSettingsEnv::EnvVar env );
392
400 int capabilitiesCacheSize() const;
401
402 private:
403 void initSettings();
404 QVariant value( QgsServerSettingsEnv::EnvVar envVar, bool actual = false ) const;
405 QMap<QgsServerSettingsEnv::EnvVar, QString> getEnv() const;
406 void loadQSettings( const QString &envOptPath ) const;
407 void prioritize( const QMap<QgsServerSettingsEnv::EnvVar, QString> &env );
408
409 QMap<QgsServerSettingsEnv::EnvVar, Setting> mSettings;
410};
411
412#endif
MessageLevel
Level for messages This will be used both for message log and message bar in application.
Definition qgis.h:156
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.
@ QGIS_SERVER_PROJECT_CACHE_SIZE
Set the project cache size, in number of projects.
@ QGIS_SERVER_WMTS_SERVICE_URL
To set the WMTS service URL if it's not present in the project.
@ QGIS_SERVER_IGNORE_BAD_LAYERS
Do not consider the whole project unavailable if it contains bad layers.
@ QGIS_SERVER_ALLOWED_EXTRA_SQL_TOKENS
Adds these tokens to the list of allowed tokens that the services accept when filtering features.
@ QGIS_SERVER_API_WFS3_ROOT_PATH
Root path for OAPIF (WFS3) service API, default value is "/wfs3".
@ QGIS_SERVER_CAPABILITIES_CACHE_SIZE
Define the QGIS Server capabilities cache size.
@ QGIS_SERVER_LANDING_PAGE_PREFIX
Prefix of the path component of the landing page base URL, default is empty.
@ QGIS_SERVER_TRUST_LAYER_METADATA
Trust layer metadata. Improves project read time.
@ QGIS_SERVER_RETRY_BAD_LAYERS
Retry bad layers in following request in case they might only be temporary unavailable.
@ QGIS_SERVER_WFS_SERVICE_URL
To set the WFS service URL if it's not present in the project.
@ QGIS_SERVER_OVERRIDE_SYSTEM_LOCALE
Override system locale.
@ QGIS_SERVER_LANDING_PAGE_PROJECTS_PG_CONNECTIONS
PostgreSQL connection strings used by the landing page service to find projects.
@ QGIS_SERVER_API_WFS3_MAX_LIMIT
Maximum value for "limit" in a features request, defaults to 10000.
@ 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_IGNORE_RENDERING_ERRORS
Ignore rendering errors if true. If false, the server returns an error if a rendering error occurs.
@ QGIS_SERVER_WMS_MAX_WIDTH
Maximum width for a WMS request. The most conservative between this and the project one is used.
@ QGIS_SERVER_FORCE_READONLY_LAYERS
Force to open layers in read-only mode.
@ QGIS_SERVER_PROJECT_CACHE_STRATEGY
Set the project cache strategy. Possible values are 'filesystem', 'periodic' or 'off'.
@ QGIS_SERVER_APPLICATION_NAME
Define the QGIS Server application name.
@ QGIS_SERVER_WMS_MAX_HEIGHT
Maximum height for a WMS request. The most conservative between this and the project one is used.
@ QGIS_SERVER_WMS_SERVICE_URL
To set the WMS service URL if it's not present in the project.
@ QGIS_SERVER_DISABLE_GETPRINT
Disabled WMS GetPrint request and don't load layouts. Improves project read time.
@ QGIS_SERVER_PROJECT_CACHE_CHECK_INTERVAL
Set the interval in milliseconds for cache invalidation strategy 'interval', default to 0 which selec...
@ QGIS_SERVER_SHOW_GROUP_SEPARATOR
Show group (thousands) separator when formatting numeric values, defaults to false.
@ QGIS_SERVER_LANDING_PAGE_PROJECTS_DIRECTORIES
Directories used by the landing page service to find .qgs and .qgz projects.
@ 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.
QString serviceUrl(const QString &service) const
Returns the service URL from the setting.
QString cacheDirectory() const
Returns the cache directory.
bool getPrintDisabled() const
Returns true if WMS GetPrint request is disabled and the project's reading flag QgsProject::ReadFlag:...
int projectCacheSize() const
Returns the projects cache size The default value is 100, the value can be changed by setting the env...
QString landingPageProjectsPgConnections() const
Returns the PostgreSQL connection strings used by the landing page service to find projects.
int maxThreads() const
Returns the maximum number of threads to use.
bool logStderr() const
Returns whether logging to stderr is activated.
QgsServerSettings()
Constructor.
QString projectFile() const
Returns the QGS project file to use.
QString apiResourcesDirectory() const
Returns the server-wide base directory where HTML templates and static assets (e.g.
int projectCacheCheckInterval() const
Returns the config cache check interval (in ms) for the 'periodic' strategy.
Qgis::MessageLevel logLevel() const
Returns the log level.
bool retryBadLayers() const
Returns true if bad layers should be re-checked after the project has been cached.
bool logProfile() const
Returns true if profile information has to be added to the logs, default value is false.
QStringList allowedExtraSqlTokens() const
Returns the list of strings that represent the allowed extra SQL tokens accepted as components of a f...
bool forceReadOnlyLayers() const
Returns true if the reading flag force layer read only is activated.
int wmsMaxWidth() const
Returns the server-wide max width of a WMS GetMap request.
int capabilitiesCacheSize() const
Returns the maximum number of project capabilities to cache.
static QString name(QgsServerSettingsEnv::EnvVar env)
Returns the string representation of a setting.
QString landingPageBaseUrlPrefix() const
Returns the landing page base URL regular expression, defaults to /.
void logSummary() const
Log a summary of settings currently loaded.
QString apiWfs3RootPath() const
Returns the server-wide root path for OAPIF (WFS3) service API.
QString logFile() const
Returns the log file.
qlonglong apiWfs3MaxLimit() const
Returns the server-wide maximum allowed value for "limit" in a features request.
bool ignoreRenderingErrors() const
Returns true if rendering errors are ignored by the server.
int wmsMaxHeight() const
Returns the server-wide max height of a WMS GetMap request.
QString landingPageProjectsDirectories() const
Returns the directories used by the landing page service to find .qgs and .qgz projects.
bool parallelRendering() const
Returns parallel rendering setting.
QString applicationName() const
Returns the QGIS Server application name.
bool showGroupSeparator() const
Show group (thousand) separator.
bool ignoreBadLayers() const
Returns true if the bad layers are ignored and false when the presence of a bad layers invalidates th...
QString iniFile() const
Returns the ini file loaded by QSetting.
QString projectCacheStrategy() const
Returns the project's cache strategy The default value is 'filesystem', the value can be changed by s...
QString overrideSystemLocale() const
Overrides system locale.
bool trustLayerMetadata() const
Returns true if the reading flag trust layer metadata is activated.
void load()
Load settings according to current environment variables.
qint64 cacheSize() const
Returns the cache size.
#define SIP_SKIP
Definition qgis_sip.h:134
QgsServerSettingsEnv::EnvVar envVar
QgsServerSettingsEnv::Source src