Skip to content
Permalink
Browse files

Use pg connection enum

  • Loading branch information
pblottiere committed Aug 27, 2020
1 parent ccb72fb commit c7fa78ac3563a504d4fe274dfede8a9d4bf37c99
@@ -253,6 +253,18 @@ void QgsServerSettings::initSettings()
};

mSettings[ sProjectsDirectories.envVar ] = sProjectsDirectories;

// postgresql connection string for landing page service
const Setting sProjectsPgConnections = { QgsServerSettingsEnv::QGIS_SERVER_PROJECTS_PG_CONNECTIONS,
QgsServerSettingsEnv::DEFAULT_VALUE,
QStringLiteral( "PostgreSQL connection strings used by the landing page service to find projects" ),
QStringLiteral( "/qgis/server_projects_pg_connections" ),
QVariant::String,
QVariant( "" ),
QVariant()
};

mSettings[ sProjectsPgConnections.envVar ] = sProjectsPgConnections;
}

void QgsServerSettings::load()
@@ -71,7 +71,7 @@ class SERVER_EXPORT QgsServerSettingsEnv : public QObject
QGIS_SERVER_TRUST_LAYER_METADATA, //!< Trust layer metadata. Improves project read time. (since QGIS 3.16).
QGIS_SERVER_DISABLE_GETPRINT //!< Disabled WMS GetPrint request and don't load layouts. Improves project read time. (since QGIS 3.16).
QGIS_SERVER_PROJECTS_DIRECTORIES, //!< Directories used by the landing page service to find .qgs and .qgz projects (since QGIS 3.16)
QGIS_SERVER_PROJECTS_PG_CONNECTIONS //!< PostgreSQL connection string used by the landing page service to find projects (since QGIS 3.16)
QGIS_SERVER_PROJECTS_PG_CONNECTIONS //!< PostgreSQL connection strings used by the landing page service to find projects (since QGIS 3.16)
};
Q_ENUM( EnvVar )
};
@@ -66,7 +66,8 @@ QMap<QString, QString> QgsLandingPageUtils::projects( const QgsServerSettings &s
dirWatcher.removePaths( cWatchedDirs );
}

const QString pgConnections { QString( qgetenv( "QGIS_SERVER_PROJECTS_PG_CONNECTIONS" ) ) };
const QString pgConnections { settings.projectsPgConnections() };
QgsMessageLog::logMessage( QStringLiteral( "PGONNECTIONS: %1" ).arg( pgConnections ), QStringLiteral( "Landing Page" ), Qgis::MessageLevel::Info );

// Clear cache if QGIS_SERVER_PROJECTS_PG_CONNECTIONS has changed
if ( pgConnections != QGIS_SERVER_PROJECTS_PG_CONNECTIONS )

0 comments on commit c7fa78a

Please sign in to comment.
You can’t perform that action at this time.