mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Set permissions on config files under config.d/
Do not create config files under config.d/ if already exist
This commit is contained in:
parent
a36f7abc56
commit
b591cf49a3
@ -492,8 +492,9 @@ int mainEntryClickHouseInstall(int argc, char ** argv)
|
|||||||
/// Override the default paths.
|
/// Override the default paths.
|
||||||
|
|
||||||
/// Data paths.
|
/// Data paths.
|
||||||
|
const std::string data_file = config_d / "data-paths.xml";
|
||||||
|
if (!fs::exists(data_file))
|
||||||
{
|
{
|
||||||
std::string data_file = config_d / "data-paths.xml";
|
|
||||||
WriteBufferFromFile out(data_file);
|
WriteBufferFromFile out(data_file);
|
||||||
out << "<clickhouse>\n"
|
out << "<clickhouse>\n"
|
||||||
" <path>" << data_path.string() << "</path>\n"
|
" <path>" << data_path.string() << "</path>\n"
|
||||||
@ -503,12 +504,14 @@ int mainEntryClickHouseInstall(int argc, char ** argv)
|
|||||||
"</clickhouse>\n";
|
"</clickhouse>\n";
|
||||||
out.sync();
|
out.sync();
|
||||||
out.finalize();
|
out.finalize();
|
||||||
|
fs::permissions(data_file, fs::perms::owner_read, fs::perm_options::replace);
|
||||||
fmt::print("Data path configuration override is saved to file {}.\n", data_file);
|
fmt::print("Data path configuration override is saved to file {}.\n", data_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Logger.
|
/// Logger.
|
||||||
|
const std::string logger_file = config_d / "logger.xml";
|
||||||
|
if (!fs::exists(logger_file))
|
||||||
{
|
{
|
||||||
std::string logger_file = config_d / "logger.xml";
|
|
||||||
WriteBufferFromFile out(logger_file);
|
WriteBufferFromFile out(logger_file);
|
||||||
out << "<clickhouse>\n"
|
out << "<clickhouse>\n"
|
||||||
" <logger>\n"
|
" <logger>\n"
|
||||||
@ -518,12 +521,14 @@ int mainEntryClickHouseInstall(int argc, char ** argv)
|
|||||||
"</clickhouse>\n";
|
"</clickhouse>\n";
|
||||||
out.sync();
|
out.sync();
|
||||||
out.finalize();
|
out.finalize();
|
||||||
|
fs::permissions(logger_file, fs::perms::owner_read, fs::perm_options::replace);
|
||||||
fmt::print("Log path configuration override is saved to file {}.\n", logger_file);
|
fmt::print("Log path configuration override is saved to file {}.\n", logger_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// User directories.
|
/// User directories.
|
||||||
|
const std::string user_directories_file = config_d / "user-directories.xml";
|
||||||
|
if (!fs::exists(user_directories_file))
|
||||||
{
|
{
|
||||||
std::string user_directories_file = config_d / "user-directories.xml";
|
|
||||||
WriteBufferFromFile out(user_directories_file);
|
WriteBufferFromFile out(user_directories_file);
|
||||||
out << "<clickhouse>\n"
|
out << "<clickhouse>\n"
|
||||||
" <user_directories>\n"
|
" <user_directories>\n"
|
||||||
@ -534,12 +539,14 @@ int mainEntryClickHouseInstall(int argc, char ** argv)
|
|||||||
"</clickhouse>\n";
|
"</clickhouse>\n";
|
||||||
out.sync();
|
out.sync();
|
||||||
out.finalize();
|
out.finalize();
|
||||||
|
fs::permissions(user_directories_file, fs::perms::owner_read, fs::perm_options::replace);
|
||||||
fmt::print("User directory path configuration override is saved to file {}.\n", user_directories_file);
|
fmt::print("User directory path configuration override is saved to file {}.\n", user_directories_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// OpenSSL.
|
/// OpenSSL.
|
||||||
|
const std::string openssl_file = config_d / "openssl.xml";
|
||||||
|
if (!fs::exists(openssl_file))
|
||||||
{
|
{
|
||||||
std::string openssl_file = config_d / "openssl.xml";
|
|
||||||
WriteBufferFromFile out(openssl_file);
|
WriteBufferFromFile out(openssl_file);
|
||||||
out << "<clickhouse>\n"
|
out << "<clickhouse>\n"
|
||||||
" <openSSL>\n"
|
" <openSSL>\n"
|
||||||
@ -552,6 +559,7 @@ int mainEntryClickHouseInstall(int argc, char ** argv)
|
|||||||
"</clickhouse>\n";
|
"</clickhouse>\n";
|
||||||
out.sync();
|
out.sync();
|
||||||
out.finalize();
|
out.finalize();
|
||||||
|
fs::permissions(openssl_file, fs::perms::owner_read, fs::perm_options::replace);
|
||||||
fmt::print("OpenSSL path configuration override is saved to file {}.\n", openssl_file);
|
fmt::print("OpenSSL path configuration override is saved to file {}.\n", openssl_file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user