Standalone CLI tools don't support specifying a path for the cta-cli.conf file
Problem to solve
In the cta-admin
cli tool we have the option to detect and specify cta-cli.conf
files outside of /etc/cta/
:
However, in the standalone cli tools, such as cta-verify-file
the file /etc/cta/cta-cli.conf
is hard-coded.
The operator tools cta-ops-...
now make use of a cta-cli.conf
file which is not at the default path, such that they can be configured separate to the host default.
Ideally, cta-ops-...
command should be able to specify this file for the standalone CTA commands as well. Otherwise we'd have to duplicate this information in the cta-ops
configuration file.
Stakeholders
Operators/cta-ops-...
-users.
Proposal
In cta-admin
conf file specification is implemented using the following:
const std::string CtaAdminCmd::getConfigFilePath() const {
std::filesystem::path config_file = DEFAULT_CLI_CONFIG;
if(std::getenv("HOME")) {
const std::filesystem::path home = std::getenv("HOME");
const std::filesystem::path home_dir_config_file = home / ".cta/cta-cli.conf";
if(std::filesystem::exists(home_dir_config_file)) { config_file = home_dir_config_file; }
}
if(m_config) {
config_file = m_config.value();
}
return config_file;
}
Whereas in the standalone tools such as cta-verify-file
it is simply a constant:
const std::string g_config_file = "/etc/cta/cta-cli.conf";
We should propagate the cta-admin solution to the other tools. This way the cli-tools will have consistent behavior, and allow the operator tools to override when needed.