mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-17 07:41:23 +01:00
add conduit compat mode
This makes it possible to deploy Grapevine while using a database originally created by Conduit, including leaving the admin bot user's localpart the same as before.
This commit is contained in:
parent
33e7a46b53
commit
a25f2ec950
6 changed files with 104 additions and 22 deletions
|
|
@ -176,7 +176,16 @@ impl KeyValueDatabase {
|
|||
fn check_db_setup(config: &Config) -> Result<()> {
|
||||
let path = Path::new(&config.database_path);
|
||||
|
||||
let sqlite_exists = path.join("grapevine.db").exists();
|
||||
let sqlite_exists = path
|
||||
.join(format!(
|
||||
"{}.db",
|
||||
if config.conduit_compat {
|
||||
"conduit"
|
||||
} else {
|
||||
"grapevine"
|
||||
}
|
||||
))
|
||||
.exists();
|
||||
let rocksdb_exists = path.join("IDENTITY").exists();
|
||||
|
||||
let mut count = 0;
|
||||
|
|
@ -401,9 +410,15 @@ impl KeyValueDatabase {
|
|||
// Matrix resource ownership is based on the server name; changing it
|
||||
// requires recreating the database from scratch.
|
||||
if services().users.count()? > 0 {
|
||||
let grapevine_user =
|
||||
UserId::parse_with_server_name("grapevine", services().globals.server_name())
|
||||
.expect("@grapevine:server_name is valid");
|
||||
let grapevine_user = UserId::parse_with_server_name(
|
||||
if services().globals.config.conduit_compat {
|
||||
"conduit"
|
||||
} else {
|
||||
"grapevine"
|
||||
},
|
||||
services().globals.server_name(),
|
||||
)
|
||||
.expect("admin bot username should be valid");
|
||||
|
||||
if !services().users.exists(&grapevine_user)? {
|
||||
error!(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue