-
Notifications
You must be signed in to change notification settings - Fork 185
Description
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.