mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 17:19:15 +08:00
feat(multitenancy): add support for multitenancy and handle the same in router, producer, consumer, drainer and analytics (#4630)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: Arun Raj M <jarnura47@gmail.com>
This commit is contained in:
@ -4,12 +4,14 @@ use api_models::{
|
||||
analytics::refunds::RefundType,
|
||||
enums::{DisputeStage, DisputeStatus},
|
||||
};
|
||||
use common_utils::errors::{CustomResult, ParsingError};
|
||||
use common_utils::{
|
||||
errors::{CustomResult, ParsingError},
|
||||
DbConnectionParams,
|
||||
};
|
||||
use diesel_models::enums::{
|
||||
AttemptStatus, AuthenticationType, Currency, PaymentMethod, RefundStatus,
|
||||
};
|
||||
use error_stack::ResultExt;
|
||||
use masking::PeekInterface;
|
||||
use sqlx::{
|
||||
postgres::{PgArgumentBuffer, PgPoolOptions, PgRow, PgTypeInfo, PgValueRef},
|
||||
Decode, Encode,
|
||||
@ -49,12 +51,8 @@ impl Default for SqlxClient {
|
||||
}
|
||||
|
||||
impl SqlxClient {
|
||||
pub async fn from_conf(conf: &Database) -> Self {
|
||||
let password = &conf.password.peek();
|
||||
let database_url = format!(
|
||||
"postgres://{}:{}@{}:{}/{}",
|
||||
conf.username, password, conf.host, conf.port, conf.dbname
|
||||
);
|
||||
pub async fn from_conf(conf: &Database, schema: &str) -> Self {
|
||||
let database_url = conf.get_database_url(schema);
|
||||
#[allow(clippy::expect_used)]
|
||||
let pool = PgPoolOptions::new()
|
||||
.max_connections(conf.pool_size)
|
||||
|
||||
Reference in New Issue
Block a user