Skip to content

How to properly setup PostgreSQL connection with TLS\SSL #1191

@zwpdbh

Description

@zwpdbh

Is the some example to demostrate how to setup TLS\SSL when connecting to a postgres server?

I am new to this area and not sure how to setup TSL\SSL when connecting to a postgres server which enabled securit connection.
During production, when I set the DATABASE_URL, the app shows error with :

DATABASE_URL='postgres://$(DATABASE_USERNAME):$(DATABASE_PASSWORD)@$(DATABASE_HOST):$(DATABASE_PORT)/$(DATABASE_NAME)?sslmode=verify-full&sslrootcert=certs/US.pem'  cargo loco start -e production
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.29s
     Running `/home/zw/code/rust_programming/myapp/target/debug/backend-cli start -e production`
2025-01-19T12:55:57.345046Z  WARN app: loco_rs::boot: pretty backtraces are enabled (this is great for development but has a runtime cost for production. disable with `logger.pretty_backtrace` in your config yaml) environment=production
Error: DB(Conn(SqlxError(Tls("server does not support TLS"))))

At the app doesn't show anymore how to setup this.

The server i am connecting during production is hosted in Azure by some other group and could be turn off sercurity connection option.

References:

Is there any suggestions how to do it? An working example would be wonderful :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions