feat(CORE): implemented AC_DISABLE_INTERACTIVE for DBUpdater (#13450)
Implement AC_DISABLE_INTERACTIVE that allow us to skip the question when the db doesn't exit
This commit is contained in:
parent
9cda0bb2e6
commit
636df19514
2 changed files with 7 additions and 3 deletions
|
|
@ -18,6 +18,8 @@ x-cache-from: &cache-from
|
||||||
x-ac-shared-conf: &ac-shared-conf
|
x-ac-shared-conf: &ac-shared-conf
|
||||||
<<: *networks
|
<<: *networks
|
||||||
working_dir: /azerothcore
|
working_dir: /azerothcore
|
||||||
|
environment:
|
||||||
|
AC_DISABLE_INTERACTIVE: "1"
|
||||||
depends_on:
|
depends_on:
|
||||||
ac-database:
|
ac-database:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
|
|
||||||
|
|
@ -170,11 +170,13 @@ BaseLocation DBUpdater<T>::GetBaseLocationType()
|
||||||
template<class T>
|
template<class T>
|
||||||
bool DBUpdater<T>::Create(DatabaseWorkerPool<T>& pool)
|
bool DBUpdater<T>::Create(DatabaseWorkerPool<T>& pool)
|
||||||
{
|
{
|
||||||
LOG_WARN("sql.updates", "Database \"{}\" does not exist, do you want to create it? [yes (default) / no]: ",
|
LOG_WARN("sql.updates", "Database \"{}\" does not exist", pool.GetConnectionInfo()->database);
|
||||||
pool.GetConnectionInfo()->database);
|
|
||||||
|
|
||||||
if (!sConfigMgr->isDryRun())
|
const char* interactiveOpt = std::getenv("AC_DISABLE_INTERACTIVE");
|
||||||
|
|
||||||
|
if (!sConfigMgr->isDryRun() && std::strcmp(interactiveOpt, "1") != 0)
|
||||||
{
|
{
|
||||||
|
std::cout << "Do you want to create it? [yes (default) / no]:" << std::endl;
|
||||||
std::string answer;
|
std::string answer;
|
||||||
std::getline(std::cin, answer);
|
std::getline(std::cin, answer);
|
||||||
if (!answer.empty() && !(answer.substr(0, 1) == "y"))
|
if (!answer.empty() && !(answer.substr(0, 1) == "y"))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue