diff options
author | Yehonal <yehonal.azeroth@gmail.com> | 2022-10-19 10:57:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-19 10:57:29 +0200 |
commit | 636df195147ffeae3ea9ffbdc0cbb97a95e02cd2 (patch) | |
tree | bbd42e35b753453b5b08a6c0e0230f7a9e726837 | |
parent | 9cda0bb2e606cd769760b667fb5e3535bc88e377 (diff) |
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
-rw-r--r-- | docker-compose.yml | 2 | ||||
-rw-r--r-- | src/server/database/Updater/DBUpdater.cpp | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/docker-compose.yml b/docker-compose.yml index 72d0bf1726..6217ed7be7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,6 +18,8 @@ x-cache-from: &cache-from x-ac-shared-conf: &ac-shared-conf <<: *networks working_dir: /azerothcore + environment: + AC_DISABLE_INTERACTIVE: "1" depends_on: ac-database: condition: service_healthy diff --git a/src/server/database/Updater/DBUpdater.cpp b/src/server/database/Updater/DBUpdater.cpp index bf1f7c60b2..af12f9ba7e 100644 --- a/src/server/database/Updater/DBUpdater.cpp +++ b/src/server/database/Updater/DBUpdater.cpp @@ -170,11 +170,13 @@ BaseLocation DBUpdater<T>::GetBaseLocationType() template<class T> bool DBUpdater<T>::Create(DatabaseWorkerPool<T>& pool) { - LOG_WARN("sql.updates", "Database \"{}\" does not exist, do you want to create it? [yes (default) / no]: ", - pool.GetConnectionInfo()->database); + LOG_WARN("sql.updates", "Database \"{}\" does not exist", 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::getline(std::cin, answer); if (!answer.empty() && !(answer.substr(0, 1) == "y")) |