Skip to content

Dynamic or short lived configs based on temporary credentials in deadpool_postgres #402

@Aiden-Ziegelaar

Description

@Aiden-Ziegelaar

I was looking at issue #396 and it struck me that there might be a wider use case here. For tokio_postgres the config is scoped to a single connection so it makes sense to be static as it's used for initiating the connection. For scenarios where the config may only be valid for a short time window (i.e. RDS IAM) would it make sense to have a trait that could be implemented by consumers that produces a tokio_postgres config, then a generic implementing this trait is used for new connections? This would allow for much more dynamic configuration of the application i.e. maintaining hosts, etc. This would allow all of the temporary credential use cases to be met without implementing specific logic in the crate for each one.

Something like:

pub trait TokioPostgresConfigProvider {
    /// Returns a [`tokio_postgres::Config`] instance.
    fn get_pg_config(&self) -> Result<tokio_postgres::Config, ConfigError>;
}

I have a vested interest in this as I'd like it for a personal project, so happy to help out here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-deadpool-*Area: deadpool backendA-postgresArea: PostgreSQL support / deadpool-postgresenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions