Skip to content

Commit

Permalink
Remove breaking change
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderKeynes committed Sep 3, 2024
1 parent fa05ae3 commit f48578d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
4 changes: 0 additions & 4 deletions .circleci/pgcat.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ tls_private_key = ".circleci/server.key"
# Connecting to that database allows running commands like `SHOW POOLS`, `SHOW DATABASES`, etc..
admin_username = "admin_user"
admin_password = "admin_pass"
admin_auth_type = "md5"

# pool
# configs are structured as pool.<pool_name>
Expand Down Expand Up @@ -99,7 +98,6 @@ sharding_function = "pg_bigint_hash"
[pools.sharded_db.users.0]
username = "sharding_user"
password = "sharding_user"
auth_type = "md5"
# Maximum number of server connections that can be established for this user
# The maximum number of connection from a single Pgcat process to any database in the cluster
# is the sum of pool_size across all users.
Expand All @@ -109,7 +107,6 @@ statement_timeout = 0
[pools.sharded_db.users.1]
username = "other_user"
password = "other_user"
auth_type = "md5"
pool_size = 21
statement_timeout = 30000

Expand Down Expand Up @@ -150,7 +147,6 @@ prepared_statements_cache_size = 500
[pools.simple_db.users.0]
username = "simple_user"
password = "simple_user"
auth_type = "md5"
pool_size = 5
statement_timeout = 30000

Expand Down
5 changes: 0 additions & 5 deletions pgcat.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ verify_server_certificate = false
admin_username = "admin_user"
# Password to access the virtual administrative database
admin_password = "admin_pass"
admin_auth_type = "md5"

# Default plugins that are configured on all pools.
[plugins]
Expand Down Expand Up @@ -275,8 +274,6 @@ result = [
# if `server_username` is not set.
username = "sharding_user"

auth_type = "md5"

# PostgreSQL password used to authenticate the user and connect to the server
# if `server_password` is not set.
password = "sharding_user"
Expand All @@ -302,7 +299,6 @@ statement_timeout = 0
[pools.sharded_db.users.1]
username = "other_user"
password = "other_user"
auth_type = "md5"
pool_size = 21
statement_timeout = 15000
connect_timeout = 1000
Expand Down Expand Up @@ -341,7 +337,6 @@ sharding_function = "pg_bigint_hash"
[pools.simple_db.users.0]
username = "simple_user"
password = "simple_user"
auth_type = "md5"
pool_size = 5
min_pool_size = 3
server_lifetime = 60000
Expand Down
13 changes: 13 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ impl Address {
pub struct User {
pub username: String,
pub password: Option<String>,

#[serde(default = "User::default_auth_type")]
pub auth_type: String,
pub auth_ldapsuffix: Option<String>,
pub auth_ldapurl: Option<String>,
Expand Down Expand Up @@ -245,6 +247,10 @@ impl Default for User {
}

impl User {
pub fn default_auth_type() -> String {
"md5".into()
}

fn validate(&self) -> Result<(), Error> {
if let Some(min_pool_size) = self.min_pool_size {
if min_pool_size > self.pool_size {
Expand Down Expand Up @@ -339,7 +345,10 @@ pub struct General {

pub admin_username: String,
pub admin_password: String,

#[serde(default = "General::default_admin_auth_type")]
pub admin_auth_type: String,

pub admin_auth_ldapurl: Option<String>,
pub admin_auth_ldapsuffix: Option<String>,

Expand All @@ -357,6 +366,10 @@ impl General {
"0.0.0.0".into()
}

pub fn default_admin_auth_type() -> String {
"md5".into()
}

pub fn default_port() -> u16 {
5432
}
Expand Down

0 comments on commit f48578d

Please sign in to comment.