Check properly database type and show proper messages on error
This commit is contained in:
parent
f18e3570a8
commit
93418187e2
1 changed files with 16 additions and 0 deletions
|
@ -357,7 +357,13 @@ int main(int argc, char **argv)
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (CONFIG_STRING(&config, "database.type") == "sqlite3") {
|
||||
std::cerr << "Spectrum2 is not compiled with mysql backend.\n";
|
||||
return -2;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WITH_MYSQL
|
||||
if (CONFIG_STRING(&config, "database.type") == "mysql") {
|
||||
storageBackend = new MySQLBackend(&config);
|
||||
|
@ -366,8 +372,18 @@ int main(int argc, char **argv)
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (CONFIG_STRING(&config, "database.type") == "mysql") {
|
||||
std::cerr << "Spectrum2 is not compiled with mysql backend.\n";
|
||||
return -2;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (CONFIG_STRING(&config, "database.type") != "mysql" && CONFIG_STRING(&config, "database.type") != "sqlite3") {
|
||||
std::cerr << "Unknown storage backend " << CONFIG_STRING(&config, "database.type") << "\n";
|
||||
return -2;
|
||||
}
|
||||
|
||||
UserManager userManager(&transport, &userRegistry, storageBackend);
|
||||
userManager_ = &userManager;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue