I'm trying to set the SET DATABASE_URL for pg_tileserv in the cmd terminal using:


which seems to be accepted. But when I start pg_tileserv.exe, the new terminal returns what's expected:

time="2021-02-21T14:45:09+02:00" level=info msg="pg_tileserv latest"
time="2021-02-21T14:45:09+02:00" level=info msg="Run with --help parameter for commandline options"
time="2021-02-21T14:45:09+02:00" level=info msg="Using database connection info from environment variable DATABASE_URL"
time="2021-02-21T14:45:09+02:00" level=info msg="Using config file: C:\\Program Files\\Pgtileserve\\config\\pg_tileserv.toml"
time="2021-02-21T14:45:09+02:00" level=info msg="Serving HTTP  at"
time="2021-02-21T14:45:09+02:00" level=info msg="Serving HTTPS at"
time="2021-02-21T14:45:09+02:00" level=info msg="Using CoordinateSystem.SRID 3857 with bounds [-2.00375083427892e+07, -2.00375083427892e+07, 2.00375083427892e+07, 2.00375083427892e+07]"

except the Connected as... to database on pgadmin, so the web interface doesn't start up.

So I don't know why the database_url is not being set. I'm following this tutorial in Linux, which I'm not familiar with. It may be that the translating those commands to Windows is what's tripping me up. Or the tutorial is linked to a database on Crunchydata, and I'm trying to connect to PgAdmin.

I've tried different versions of the URL that remove the port/ change the host to localhost/ add the URL to the pg_tileserv.toml file in config/ remove the user and password.

  • Setting an environment variable in a process only applies to that process and its children. If the pg_tileserv.exe binary only notifies the service to start, then it will start with the services' environment, which will not include your changes. Try using the system's UI to change the variable instead: google.com/search?q=windows+change+environment+variable
    – Vince
    Feb 21, 2021 at 16:59
  • 1
    Turns out that I was using the wrong pgsql port, the one that shows up on the browser:60999, instead of the one postgres was actually set to: 5432.
    – Winni
    Feb 22, 2021 at 6:01


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.