pub struct SqlBindingConfig {
pub dir: Option<PathBuf>,
pub url: Option<String>,
pub admin_url: Option<String>,
pub replica_url: Option<String>,
pub token_env: Option<String>,
pub admin_token_env: Option<String>,
pub preview_mode: Option<String>,
pub preview_init: Option<PathBuf>,
pub databases: BTreeMap<String, ExternalDatabaseConfig>,
}Expand description
libsql settings for the handler sql binding — the single SQL backend. Each
site gets a real database boundary (an embedded file per site, or a sqld
namespace per site), never schema separation (which arbitrary guest SQL
escapes). Setting url switches from single-node to a shared sqld cluster;
everything else stays identical.
Fields§
§dir: Option<PathBuf>Single-node: root directory for the per-site embedded database files
(default <data-dir>/handlers-sql). Ignored when url is set.
url: Option<String>Cluster: base sqld data URL (e.g. http://sqld:8080). When set, each
site is a sqld namespace addressed as a subdomain of this URL; admin_url
is then required.
admin_url: Option<String>Cluster: sqld admin API base URL (e.g. http://sqld:9090) for creating
per-site namespaces. Required when url is set.
replica_url: Option<String>Cluster: optional sqld read-replica data URL. When set, handlers’
read-only sql transactions (open-read-only) route to this endpoint
while writes stay on url (reads → replicas, writes → primary).
Reads may lag (eventually consistent). Ignored in
single-node mode (no url).
token_env: Option<String>Name of the env var holding the sqld data auth token (optional; never the token itself in-file).
admin_token_env: Option<String>Name of the env var holding the sqld admin API auth key (optional).
preview_mode: Option<String>How preview deployments get their SQL database: empty (default — a
fresh isolated db), branch (a consistent copy of the site’s live db;
single-node only), or shared (the site’s live db). See
boatramp_core::sql::PreviewSqlMode.
preview_init: Option<PathBuf>Path to an idempotent SQL script run when an empty preview database is
first opened (e.g. schema/seed). Ignored in branch/shared modes.
databases: BTreeMap<String, ExternalDatabaseConfig>handlers.bindings.sql.databases — external bring-your-own databases,
each opened by name via sql.open("<name>"). An operator-configured
Postgres/MySQL whose isolation is the operator’s (it’s their database),
so these bypass the per-site libsql boundary and are reachable by any
handler/function granted the sql binding. Needs the sql-postgres /
sql-mysql build feature for the engine. A name here shadows the same
name on the managed libsql default.
Trait Implementations§
Source§impl Clone for SqlBindingConfig
impl Clone for SqlBindingConfig
Source§fn clone(&self) -> SqlBindingConfig
fn clone(&self) -> SqlBindingConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SqlBindingConfig
impl Debug for SqlBindingConfig
Source§impl Default for SqlBindingConfig
impl Default for SqlBindingConfig
Source§fn default() -> SqlBindingConfig
fn default() -> SqlBindingConfig
Source§impl<'de> Deserialize<'de> for SqlBindingConfigwhere
SqlBindingConfig: Default,
impl<'de> Deserialize<'de> for SqlBindingConfigwhere
SqlBindingConfig: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for SqlBindingConfig
impl RefUnwindSafe for SqlBindingConfig
impl Send for SqlBindingConfig
impl Sync for SqlBindingConfig
impl Unpin for SqlBindingConfig
impl UnsafeUnpin for SqlBindingConfig
impl UnwindSafe for SqlBindingConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more