mirror of
https://github.com/postgresml/pgcat.git
synced 2026-03-27 02:36:29 +00:00
clean up
This commit is contained in:
@@ -48,3 +48,4 @@ serde_json = "1"
|
|||||||
|
|
||||||
[target.'cfg(not(target_env = "msvc"))'.dependencies]
|
[target.'cfg(not(target_env = "msvc"))'.dependencies]
|
||||||
jemallocator = "0.5.0"
|
jemallocator = "0.5.0"
|
||||||
|
|
||||||
|
|||||||
14
pgcat.toml
14
pgcat.toml
@@ -168,7 +168,7 @@ tables = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[plugins.intercept]
|
[plugins.intercept]
|
||||||
enabled = false
|
enabled = true
|
||||||
|
|
||||||
[plugins.intercept.queries.0]
|
[plugins.intercept.queries.0]
|
||||||
|
|
||||||
@@ -181,6 +181,18 @@ result = [
|
|||||||
["${DATABASE}", "{public}"],
|
["${DATABASE}", "{public}"],
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[plugins.intercept.queries.1]
|
||||||
|
|
||||||
|
query = "select current_database(), current_schema(), current_user"
|
||||||
|
schema = [
|
||||||
|
["current_database", "text"],
|
||||||
|
["current_schema", "text"],
|
||||||
|
["current_user", "text"],
|
||||||
|
]
|
||||||
|
result = [
|
||||||
|
["${DATABASE}", "public", "${USER}"],
|
||||||
|
]
|
||||||
|
|
||||||
# User configs are structured as pool.<pool_name>.users.<user_index>
|
# User configs are structured as pool.<pool_name>.users.<user_index>
|
||||||
# This section holds the credentials for users that may connect to this cluster
|
# This section holds the credentials for users that may connect to this cluster
|
||||||
[pools.sharded_db.users.0]
|
[pools.sharded_db.users.0]
|
||||||
|
|||||||
@@ -302,8 +302,6 @@ pub struct General {
|
|||||||
pub auth_query: Option<String>,
|
pub auth_query: Option<String>,
|
||||||
pub auth_query_user: Option<String>,
|
pub auth_query_user: Option<String>,
|
||||||
pub auth_query_password: Option<String>,
|
pub auth_query_password: Option<String>,
|
||||||
|
|
||||||
pub query_router_plugins: Option<Vec<String>>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl General {
|
impl General {
|
||||||
@@ -404,7 +402,6 @@ impl Default for General {
|
|||||||
auth_query_user: None,
|
auth_query_user: None,
|
||||||
auth_query_password: None,
|
auth_query_password: None,
|
||||||
server_lifetime: 1000 * 3600 * 24, // 24 hours,
|
server_lifetime: 1000 * 3600 * 24, // 24 hours,
|
||||||
query_router_plugins: None,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -483,7 +480,6 @@ pub struct Pool {
|
|||||||
pub auth_query: Option<String>,
|
pub auth_query: Option<String>,
|
||||||
pub auth_query_user: Option<String>,
|
pub auth_query_user: Option<String>,
|
||||||
pub auth_query_password: Option<String>,
|
pub auth_query_password: Option<String>,
|
||||||
pub query_router_plugins: Option<Vec<String>>,
|
|
||||||
|
|
||||||
pub shards: BTreeMap<String, Shard>,
|
pub shards: BTreeMap<String, Shard>,
|
||||||
pub users: BTreeMap<String, User>,
|
pub users: BTreeMap<String, User>,
|
||||||
@@ -605,7 +601,6 @@ impl Default for Pool {
|
|||||||
auth_query_user: None,
|
auth_query_user: None,
|
||||||
auth_query_password: None,
|
auth_query_password: None,
|
||||||
server_lifetime: None,
|
server_lifetime: None,
|
||||||
query_router_plugins: None,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -781,14 +776,6 @@ impl Config {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn fill_up_query_router_plugins(&mut self) {
|
|
||||||
for (_name, pool) in self.pools.iter_mut() {
|
|
||||||
if pool.query_router_plugins.is_none() {
|
|
||||||
pool.query_router_plugins = self.general.query_router_plugins.clone();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Config {
|
impl Default for Config {
|
||||||
@@ -1177,7 +1164,6 @@ pub async fn parse(path: &str) -> Result<(), Error> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
config.fill_up_auth_query_config();
|
config.fill_up_auth_query_config();
|
||||||
config.fill_up_query_router_plugins();
|
|
||||||
config.validate()?;
|
config.validate()?;
|
||||||
|
|
||||||
config.path = path.to_string();
|
config.path = path.to_string();
|
||||||
|
|||||||
@@ -132,8 +132,6 @@ pub struct PoolSettings {
|
|||||||
pub auth_query: Option<String>,
|
pub auth_query: Option<String>,
|
||||||
pub auth_query_user: Option<String>,
|
pub auth_query_user: Option<String>,
|
||||||
pub auth_query_password: Option<String>,
|
pub auth_query_password: Option<String>,
|
||||||
|
|
||||||
pub plugins: Option<Vec<String>>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for PoolSettings {
|
impl Default for PoolSettings {
|
||||||
@@ -158,7 +156,6 @@ impl Default for PoolSettings {
|
|||||||
auth_query: None,
|
auth_query: None,
|
||||||
auth_query_user: None,
|
auth_query_user: None,
|
||||||
auth_query_password: None,
|
auth_query_password: None,
|
||||||
plugins: None,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -453,7 +450,6 @@ impl ConnectionPool {
|
|||||||
auth_query: pool_config.auth_query.clone(),
|
auth_query: pool_config.auth_query.clone(),
|
||||||
auth_query_user: pool_config.auth_query_user.clone(),
|
auth_query_user: pool_config.auth_query_user.clone(),
|
||||||
auth_query_password: pool_config.auth_query_password.clone(),
|
auth_query_password: pool_config.auth_query_password.clone(),
|
||||||
plugins: pool_config.query_router_plugins.clone(),
|
|
||||||
},
|
},
|
||||||
validated: Arc::new(AtomicBool::new(false)),
|
validated: Arc::new(AtomicBool::new(false)),
|
||||||
paused: Arc::new(AtomicBool::new(false)),
|
paused: Arc::new(AtomicBool::new(false)),
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ module Helpers
|
|||||||
primary2 = PgInstance.new(8432, user["username"], user["password"], "shard2")
|
primary2 = PgInstance.new(8432, user["username"], user["password"], "shard2")
|
||||||
|
|
||||||
pgcat_cfg = pgcat.current_config
|
pgcat_cfg = pgcat.current_config
|
||||||
pgcat_cfg["general"]["query_router_plugins"] = ["intercept"]
|
|
||||||
pgcat_cfg["pools"] = {
|
pgcat_cfg["pools"] = {
|
||||||
"#{pool_name}" => {
|
"#{pool_name}" => {
|
||||||
"default_role" => "any",
|
"default_role" => "any",
|
||||||
|
|||||||
Reference in New Issue
Block a user