From 7bf773a67703d346661615c2a7ece3cdb4d77c29 Mon Sep 17 00:00:00 2001 From: Valentin Rakush Date: Sat, 21 Dec 2019 16:11:40 +0000 Subject: [PATCH] Cleanup of the proxysql_admin.cpp --- include/proxysql_config.h | 1 + lib/ProxySQL_Admin.cpp | 31 ------------------------------- lib/ProxySQL_Config.cpp | 31 +++++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 31 deletions(-) diff --git a/include/proxysql_config.h b/include/proxysql_config.h index 1c88f9144..59e32d277 100644 --- a/include/proxysql_config.h +++ b/include/proxysql_config.h @@ -4,6 +4,7 @@ #include class SQLite3DB; +extern const char* config_header; class ProxySQL_Config { SQLite3DB* admindb; diff --git a/lib/ProxySQL_Admin.cpp b/lib/ProxySQL_Admin.cpp index c1036c707..f40032ebd 100644 --- a/lib/ProxySQL_Admin.cpp +++ b/lib/ProxySQL_Admin.cpp @@ -102,37 +102,6 @@ static char * load_file (const char *filename) { return buffer; } -const char* config_header = "########################################################################################\n" - "# This config file is parsed using libconfig , and its grammar is described in:\n" - "# http://www.hyperrealm.com/libconfig/libconfig_manual.html#Configuration-File-Grammar\n" - "# Grammar is also copied at the end of this file\n" - "########################################################################################\n" - "\n" - "########################################################################################\n" - "# IMPORTANT INFORMATION REGARDING THIS CONFIGURATION FILE:\n" - "########################################################################################\n" - "# On startup, ProxySQL reads its config file (if present) to determine its datadir.\n" - "# What happens next depends on if the database file (disk) is present in the defined\n" - "# datadir (i.e. \"/var/lib/proxysql/proxysql.db\").\n" - "#\n" - "# If the database file is found, ProxySQL initializes its in-memory configuration from\n" - "# the persisted on-disk database. So, disk configuration gets loaded into memory and\n" - "# then propagated towards the runtime configuration.\n" - "#\n" - "# If the database file is not found and a config file exists, the config file is parsed\n" - "# and its content is loaded into the in-memory database, to then be both saved on-disk\n" - "# database and loaded at runtime.\n" - "#\n" - "# IMPORTANT: If a database file is found, the config file is NOT parsed. In this case\n" - "# ProxySQL initializes its in-memory configuration from the persisted on-disk\n" - "# database ONLY. In other words, the configuration found in the proxysql.cnf\n" - "# file is only used to initial the on-disk database read on the first startup.\n" - "#\n" - "# In order to FORCE a re-initialise of the on-disk database from the configuration file\n" - "# the ProxySQL service should be started with \"service proxysql initial\".\n" - "#\n" - "########################################################################################\n"; - /* int sqlite3_json_init( sqlite3 *db, diff --git a/lib/ProxySQL_Config.cpp b/lib/ProxySQL_Config.cpp index 62b1828ca..b7e40b4b5 100644 --- a/lib/ProxySQL_Config.cpp +++ b/lib/ProxySQL_Config.cpp @@ -4,6 +4,37 @@ #include +const char* config_header = "########################################################################################\n" + "# This config file is parsed using libconfig , and its grammar is described in:\n" + "# http://www.hyperrealm.com/libconfig/libconfig_manual.html#Configuration-File-Grammar\n" + "# Grammar is also copied at the end of this file\n" + "########################################################################################\n" + "\n" + "########################################################################################\n" + "# IMPORTANT INFORMATION REGARDING THIS CONFIGURATION FILE:\n" + "########################################################################################\n" + "# On startup, ProxySQL reads its config file (if present) to determine its datadir.\n" + "# What happens next depends on if the database file (disk) is present in the defined\n" + "# datadir (i.e. \"/var/lib/proxysql/proxysql.db\").\n" + "#\n" + "# If the database file is found, ProxySQL initializes its in-memory configuration from\n" + "# the persisted on-disk database. So, disk configuration gets loaded into memory and\n" + "# then propagated towards the runtime configuration.\n" + "#\n" + "# If the database file is not found and a config file exists, the config file is parsed\n" + "# and its content is loaded into the in-memory database, to then be both saved on-disk\n" + "# database and loaded at runtime.\n" + "#\n" + "# IMPORTANT: If a database file is found, the config file is NOT parsed. In this case\n" + "# ProxySQL initializes its in-memory configuration from the persisted on-disk\n" + "# database ONLY. In other words, the configuration found in the proxysql.cnf\n" + "# file is only used to initial the on-disk database read on the first startup.\n" + "#\n" + "# In order to FORCE a re-initialise of the on-disk database from the configuration file\n" + "# the ProxySQL service should be started with \"service proxysql initial\".\n" + "#\n" + "########################################################################################\n"; + ProxySQL_Config::ProxySQL_Config(SQLite3DB* db) { assert(db);