diff --git a/config/Development.toml b/config/Development.toml
index 73f229b159..30bae315e6 100644
--- a/config/Development.toml
+++ b/config/Development.toml
@@ -10,7 +10,7 @@ log_format = "default"
enabled = false
# TODO: Update database credentials before running application
-[database]
+[master_database]
username = "db_user"
password = "db_pass"
host = "localhost"
diff --git a/config/config.example.toml b/config/config.example.toml
index ca82256e03..e7652225ad 100644
--- a/config/config.example.toml
+++ b/config/config.example.toml
@@ -16,7 +16,16 @@ request_body_limit = 16_384
# https_url = "https proxy url"
# Main SQL data store credentials
-[database]
+[master_database]
+username = "db_user" # DB Username
+password = "db_pass" # DB Password
+host = "localhost" # DB Host
+port = 5432 # DB Port
+dbname = "orca_db" # Name of Database
+pool_size = 5 # Number of connections to keep open
+
+# Replica SQL data store credentials
+[replica_database]
username = "db_user" # DB Username
password = "db_pass" # DB Password
host = "localhost" # DB Host
@@ -104,4 +113,4 @@ batch_size = 200 # Specifies the batch size the producer will push under a singl
# Drainer configuration, which handles draining raw SQL queries from Redis streams to the SQL database
[drainer]
stream_name = "DRAINER_STREAM" # Specifies the stream name to be used by the drainer
-num_partitions = 64 # Specifies the number of partitions the stream will be divided into
\ No newline at end of file
+num_partitions = 64 # Specifies the number of partitions the stream will be divided into
diff --git a/config/docker_compose.toml b/config/docker_compose.toml
index 0ac1f2e564..93593f059b 100644
--- a/config/docker_compose.toml
+++ b/config/docker_compose.toml
@@ -16,7 +16,7 @@ level = "DEBUG" # What you see in your terminal.
[log.telemetry]
enabled = false # Whether tracing/telemetry is enabled.
-[database]
+[master_database]
username = "db_user"
password = "db_pass"
host = "pg"
diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml
index d08aa1482b..5211b034eb 100644
--- a/crates/router/Cargo.toml
+++ b/crates/router/Cargo.toml
@@ -13,6 +13,7 @@ default = []
kms = ["aws-config", "aws-sdk-kms"]
stripe = ["dep:serde_qs"]
sandbox = ["kms", "stripe"]
+olap = []
production = []
kv_store = []
diff --git a/crates/router/src/configs/defaults.toml b/crates/router/src/configs/defaults.toml
index 5998b6f0c8..75de8516d9 100644
--- a/crates/router/src/configs/defaults.toml
+++ b/crates/router/src/configs/defaults.toml
@@ -9,7 +9,7 @@ request_body_limit = 16_384 # Post request body is limited to 16k.
# http_url = ""
# https_url = ""
-[database]
+[master_database]
username = "none"
password = "none"
host = "localhost"
diff --git a/crates/router/src/configs/settings.rs b/crates/router/src/configs/settings.rs
index 92e76d59e6..07fb6a41a4 100644
--- a/crates/router/src/configs/settings.rs
+++ b/crates/router/src/configs/settings.rs
@@ -23,7 +23,9 @@ pub struct Settings {
pub server: Server,
pub proxy: Proxy,
pub env: Env,
- pub database: Database,
+ pub master_database: Database,
+ #[cfg(feature = "olap")]
+ pub replica_database: Database,
pub redis: Redis,
pub log: Log,
pub keys: Keys,
diff --git a/crates/router/src/db/address.rs b/crates/router/src/db/address.rs
index 6890222a57..ad90307da5 100644
--- a/crates/router/src/db/address.rs
+++ b/crates/router/src/db/address.rs
@@ -22,7 +22,7 @@ pub trait IAddress {
#[async_trait::async_trait]
impl IAddress for Store {
async fn find_address(&self, address_id: &str) -> CustomResult
{
- let conn = pg_connection(&self.pg_pool.conn).await;
+ let conn = pg_connection(&self.master_pool.conn).await;
Address::find_by_address_id(&conn, address_id).await
}
@@ -31,7 +31,7 @@ impl IAddress for Store {
address_id: String,
address: AddressUpdate,
) -> CustomResult {
- let conn = pg_connection(&self.pg_pool.conn).await;
+ let conn = pg_connection(&self.master_pool.conn).await;
Address::update_by_address_id(&conn, address_id, address).await
}
@@ -39,7 +39,7 @@ impl IAddress for Store {
&self,
address: AddressNew,
) -> CustomResult {
- let conn = pg_connection(&self.pg_pool.conn).await;
+ let conn = pg_connection(&self.master_pool.conn).await;
address.insert(&conn).await
}
}
diff --git a/crates/router/src/db/configs.rs b/crates/router/src/db/configs.rs
index 6d421b32f6..e8fd8ea82b 100644
--- a/crates/router/src/db/configs.rs
+++ b/crates/router/src/db/configs.rs
@@ -21,12 +21,12 @@ pub trait IConfig {
#[async_trait::async_trait]
impl IConfig for Store {
async fn insert_config(&self, config: ConfigNew) -> CustomResult {
- let conn = pg_connection(&self.pg_pool.conn).await;
+ let conn = pg_connection(&self.master_pool.conn).await;
config.insert(&conn).await
}
async fn find_config_by_key(&self, key: &str) -> CustomResult {
- let conn = pg_connection(&self.pg_pool.conn).await;
+ let conn = pg_connection(&self.master_pool.conn).await;
Config::find_by_key(&conn, key).await
}
@@ -35,7 +35,7 @@ impl IConfig for Store {
key: &str,
config_update: ConfigUpdate,
) -> CustomResult {
- let conn = pg_connection(&self.pg_pool.conn).await;
+ let conn = pg_connection(&self.master_pool.conn).await;
Config::update_by_key(&conn, key, config_update).await
}
}
diff --git a/crates/router/src/db/connector_response.rs b/crates/router/src/db/connector_response.rs
index 3a85a8d60e..89979dd55d 100644
--- a/crates/router/src/db/connector_response.rs
+++ b/crates/router/src/db/connector_response.rs
@@ -30,7 +30,7 @@ impl IConnectorResponse for Store {
&self,
connector_response: ConnectorResponseNew,
) -> CustomResult {
- let conn = pg_connection(&self.pg_pool.conn).await;
+ let conn = pg_connection(&self.master_pool.conn).await;
connector_response.insert(&conn).await
}
@@ -40,7 +40,7 @@ impl IConnectorResponse for Store {
merchant_id: &str,
txn_id: &str,
) -> CustomResult {
- let conn = pg_connection(&self.pg_pool.conn).await;
+ let conn = pg_connection(&self.master_pool.conn).await;
ConnectorResponse::find_by_payment_id_and_merchant_id_transaction_id(
&conn,
payment_id,
@@ -55,7 +55,7 @@ impl IConnectorResponse for Store {
this: ConnectorResponse,
connector_response_update: ConnectorResponseUpdate,
) -> CustomResult {
- let conn = pg_connection(&self.pg_pool.conn).await;
+ let conn = pg_connection(&self.master_pool.conn).await;
this.update(&conn, connector_response_update).await
}
}
diff --git a/crates/router/src/db/customers.rs b/crates/router/src/db/customers.rs
index d86f3f7ebb..b405bc7c15 100644
--- a/crates/router/src/db/customers.rs
+++ b/crates/router/src/db/customers.rs
@@ -48,7 +48,7 @@ impl ICustomer for Store {
customer_id: &str,
merchant_id: &str,
) -> CustomResult