Spiegel von
https://github.com/dani-garcia/vaultwarden.git
synchronisiert 2024-11-26 05:50:29 +01:00
Error when the URL scheme doesn't match the database type
Dieser Commit ist enthalten in:
Ursprung
662bc27523
Commit
881c1978eb
1 geänderte Dateien mit 20 neuen und 0 gelöschten Zeilen
|
@ -366,6 +366,26 @@ make_config! {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validate_config(cfg: &ConfigItems) -> Result<(), Error> {
|
fn validate_config(cfg: &ConfigItems) -> Result<(), Error> {
|
||||||
|
let db_url = cfg.database_url.to_lowercase();
|
||||||
|
|
||||||
|
if cfg!(feature = "sqlite") {
|
||||||
|
if db_url.starts_with("mysql:") || db_url.starts_with("postgresql:") {
|
||||||
|
err!("`DATABASE_URL` is meant for MySQL or Postgres, while this server is meant for SQLite")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if cfg!(feature = "mysql") {
|
||||||
|
if !db_url.starts_with("mysql:") {
|
||||||
|
err!("`DATABASE_URL` should start with mysql: when using the MySQL server")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if cfg!(feature = "postgresql") {
|
||||||
|
if !db_url.starts_with("postgresql:") {
|
||||||
|
err!("`DATABASE_URL` should start with postgresql: when using the PostgreSQL server")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(ref token) = cfg.admin_token {
|
if let Some(ref token) = cfg.admin_token {
|
||||||
if token.trim().is_empty() {
|
if token.trim().is_empty() {
|
||||||
err!("`ADMIN_TOKEN` is enabled but has an empty value. To enable the admin page without token, use `DISABLE_ADMIN_TOKEN`")
|
err!("`ADMIN_TOKEN` is enabled but has an empty value. To enable the admin page without token, use `DISABLE_ADMIN_TOKEN`")
|
||||||
|
|
Laden …
In neuem Issue referenzieren