Skip to content

Commit 9ccf9e8

Browse files
Add application_name parameter to postgres options (#335)
1 parent 7ac5659 commit 9ccf9e8

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ target/
1212
*.db
1313

1414
.vscode/settings.json
15+
.zed/settings.json
1516

1617
.DS_Store
1718

core/src/sql/db_connection_pool/postgrespool.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,14 @@ impl PostgresConnectionPool {
165165
};
166166

167167
connection_string.push_str(format!("sslmode={mode} ").as_str());
168-
let config = Config::from_str(connection_string.as_str()).context(ConnectionPoolSnafu)?;
168+
let mut config =
169+
Config::from_str(connection_string.as_str()).context(ConnectionPoolSnafu)?;
170+
171+
if let Some(application_name) = params.get("application_name").map(SecretBox::expose_secret)
172+
{
173+
config.application_name(application_name);
174+
}
175+
169176
verify_postgres_config(&config).await?;
170177

171178
let mut certs: Option<Vec<Certificate>> = None;

0 commit comments

Comments
 (0)