Serve business and admin routes from one backend process
This commit is contained in:
@@ -44,6 +44,10 @@ pub struct Connection {
|
||||
|
||||
pub async fn connect(config: &DeploymentConfig) -> Result<Connection, ConnectError> {
|
||||
let config = config.resolve()?;
|
||||
Ok(connect_resolved(&config).await?)
|
||||
}
|
||||
|
||||
pub async fn connect_resolved(config: &ResolvedDeployment) -> Result<Connection, StorageError> {
|
||||
let writer = if config.read_only {
|
||||
None
|
||||
} else {
|
||||
@@ -60,7 +64,7 @@ pub async fn connect(config: &DeploymentConfig) -> Result<Connection, ConnectErr
|
||||
Some(Writer::Sql(store)) => store.reader(),
|
||||
Some(Writer::MySql(store)) => store.reader(),
|
||||
None => {
|
||||
let reader = reader(&config, &config.primary)?;
|
||||
let reader = reader(config, &config.primary)?;
|
||||
reader.revision().await?;
|
||||
reader
|
||||
}
|
||||
@@ -68,7 +72,7 @@ pub async fn connect(config: &DeploymentConfig) -> Result<Connection, ConnectErr
|
||||
let replicas = config
|
||||
.replicas
|
||||
.iter()
|
||||
.map(|address| reader(&config, address))
|
||||
.map(|address| reader(config, address))
|
||||
.collect::<Result<_, _>>()?;
|
||||
Ok(Connection {
|
||||
driver: config.driver,
|
||||
|
||||
Reference in New Issue
Block a user