Skip to content
Permalink
Browse files

Add a setting parameter to projects method

  • Loading branch information
pblottiere committed Aug 27, 2020
1 parent 012313f commit bc3707820c334594d754a971cbd68c6b5cdabf30
@@ -66,7 +66,7 @@ const QString QgsLandingPageHandler::templatePath( const QgsServerApiContext &co
json QgsLandingPageHandler::projectsData() const
{
json j = json::array();
const auto availableProjects { QgsLandingPageUtils::projects( ) };
const auto availableProjects { QgsLandingPageUtils::projects( *mSettings ) };
const auto constProjectKeys { availableProjects.keys() };
for ( const auto &p : constProjectKeys )
{
@@ -36,7 +36,7 @@ QMap<QString, QString> QgsLandingPageUtils::AVAILABLE_PROJECTS;

std::once_flag initDirWatcher;

QMap<QString, QString> QgsLandingPageUtils::projects( )
QMap<QString, QString> QgsLandingPageUtils::projects( const QgsServerSettings &settings )
{

static QString QGIS_SERVER_PROJECTS_DIRECTORIES;
@@ -54,7 +54,7 @@ QMap<QString, QString> QgsLandingPageUtils::projects( )
} );


const QString projectDir { QString( qgetenv( "QGIS_SERVER_PROJECTS_DIRECTORIES" ) ) };
const QString projectDir { settings.projectsDirectories() };

// Clear cache if QGIS_SERVER_PROJECTS_DIRECTORIES has changed
if ( projectDir != QGIS_SERVER_PROJECTS_DIRECTORIES )
@@ -21,6 +21,7 @@
#include <QRegularExpression>

#include "nlohmann/json_fwd.hpp"
#include "qgsserversettings.h"

#ifndef SIP_RUN
using namespace nlohmann;
@@ -45,7 +46,7 @@ struct QgsLandingPageUtils
*
* \returns hash of project paths (or other storage identifiers) with a digest key
*/
static QMap<QString, QString> projects();
static QMap<QString, QString> projects( const QgsServerSettings &settings );

/**
* Returns project information for a given \a projectPath

0 comments on commit bc37078

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