use signet_cold_mdbx::MdbxConnectorError;
use thiserror::Error;
#[cfg(any(feature = "postgres", feature = "sqlite"))]
use signet_cold_sql::SqlConnectorError;
pub const ENV_HOT_PATH: &str = "SIGNET_HOT_PATH";
pub const ENV_COLD_PATH: &str = "SIGNET_COLD_PATH";
pub const ENV_COLD_SQL_URL: &str = "SIGNET_COLD_SQL_URL";
#[derive(Debug, Error)]
pub enum ConfigError {
#[error("missing environment variable: {0}")]
MissingEnvVar(&'static str),
#[error("no cold backend specified: set either {ENV_COLD_PATH} or {ENV_COLD_SQL_URL}")]
MissingColdBackend,
#[error("ambiguous cold backend: both {ENV_COLD_PATH} and {ENV_COLD_SQL_URL} are set")]
AmbiguousColdBackend,
#[error("feature '{feature}' required for {env_var} but not enabled")]
FeatureNotEnabled {
feature: &'static str,
env_var: &'static str,
},
#[error("MDBX connector error: {0}")]
MdbxConnector(#[from] MdbxConnectorError),
#[cfg(any(feature = "postgres", feature = "sqlite"))]
#[error("SQL connector error: {0}")]
SqlConnector(#[from] SqlConnectorError),
}