Skip to content

Commit

Permalink
Use pg connection enum
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed Aug 27, 2020
1 parent ccb72fb commit c7fa78a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
12 changes: 12 additions & 0 deletions src/server/qgsserversettings.cpp
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/server/qgsserversettings.h
Expand Up @@ -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 )
};
Expand Down
3 changes: 2 additions & 1 deletion src/server/services/landingpage/qgslandingpageutils.cpp
Expand Up @@ -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 )
Expand Down

0 comments on commit c7fa78a

Please sign in to comment.