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:
Yehonal 2022-10-19 10:57:29 +02:00 committed by GitHub
parent 9cda0bb2e6
commit 636df19514
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -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

View File

@ -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"))