Closed NyakudyaA closed 2 years ago
This url is invalid because postgresql:?
is not a valid project uri.
Note that the correct syntax for a posgresql stored Qgis project is postgres://[user[:pass]@]host[:port]/?dbname=X&schema=Y&project=Z
Note that in secure mode the only parameters allowed for postgres
project's uri are service
,project
,dbname
and schema
.
This url is invalid because
postgresql:?
is not a valid project uri.
Thanks, I thought it follows the way QGIS interprets the URI for Postgres projects in the properties
Note that the correct syntax for a posgresql stored Qgis project is
postgres://[user[:pass]@]host[:port]/?dbname=X&schema=Y&project=Z
even a simple request like
http://localhost:32783/ows/?SERVICE=WMS&VERSION=1.1.0&REQUEST=GetCapabilities&MAP=postgres://docker:docker@]db:5432/?dbname=data&schema=public&project=sample
doesn't get resolved until you url encode the parameter map=postgres%3A%2F%2Fdocker%3Adocker%40db%3A5432%2F%3Fdbname%3Ddata%26schema%3Dpublic%26project%3Dsample
Note that in secure mode the only parameters allowed for
postgres
project's uri areservice
,project
,dbname
andschema
.
I have tried the following
postgres://service=dev/?dbname=data&schema=public&project=sample
or postgres://service=dev&schema=public&project=sample
without any luck.
Are there any other docs or examples in the code that I can look at so that I can also update the documentation at some point
postgres://service=dev/?dbname=data&schema=public&project=sample
service
is a parameter: postgres:///?service=dev&...
Also make sure that your service file is accesible from your container.
Note: You may define the service and the service file with standards libpq environment variables: PGSERVICEFILE, PGSERVICE etc.... This will save you passing the variable in the url.
Note also that the postgres protocol supports passing the project as path in the MAP uri, i.e postgres:sample
thanks, @dmarteau So far from my testing I have the following setup
QGIS_SERVER_LANDING_PAGE_PROJECTS_PG_CONNECTIONS=postgresql:?service=dev&sslmode=require&schema=public
QGSRV_CACHE_INSECURE=no
PGSERVICEFILE=/srv/etc/pg_service.conf
QGSRV_CACHE_DEFAULT_HANDLER=postgres
And the conclusions I have drawn from this are that
postgres:///?service=dev&schema=public&project=sample&sslmode=require
or postgresql:?service=dev&sslmode=require&schema=public&project=sample
or postgres://[user[:pass]@]host[:port]/?dbname=X&schema=Y&project=Z
QGIS Server will accept all theseI consider this issue as resolved.
Problem
I have setup a running instance of this container using
3liz/qgis-map-server:3.22
in docker. I am using a service file to connect to the database resources.When trying to access the resources in the browser I can get proper getcapabilities using the encoded URL parameters of the map i.e
However, passing the same request without an encoded URL path doesn't work i.e
I get the error
Project 'postgresql:?service=dev' not found
For the second part, I can understand why the URL might fail because of failure to escape special characters
This now presents challenges when trying to get a getcapabilities response from owslib
Also trying, the same URL that works in the browser in QGIS Desktop fails with
Download of capabilities failed
Note: I am not sure if this should be a question to owslib or QGIS Desktop or here. Feel free to close and I will ask in the OWSlib channel