5
#include "include/color.h"
7
#include "auth/KeyRing.h"
8
#include "auth/AuthSupported.h"
10
void common_set_defaults(bool daemon)
13
cout << TEXT_YELLOW << " ** WARNING: Ceph is still under heavy development, and is only suitable for **" << TEXT_NORMAL << std::endl;
14
cout << TEXT_YELLOW << " ** testing and review. Do not trust it with important data. **" << TEXT_NORMAL << std::endl;
16
g_conf.daemonize = true;
18
g_conf.log_to_stdout = false;
24
void common_init(std::vector<const char*>& args, const char *module_type, bool init_keys)
27
tls_get_val()->disable_assert = 0;
29
parse_startup_config_options(args, module_type);
30
parse_config_options(args);
32
if (g_conf.log_file && g_conf.log_file[0])
33
g_conf.log_to_stdout = false;
36
if (!g_conf.log_to_stdout)
39
if (init_keys && is_supported_auth(CEPH_AUTH_CEPHX)) {
40
g_keyring.load(g_conf.keyring);
42
if (strlen(g_conf.key)) {
43
string k = g_conf.key;
45
ea.key.decode_base64(k);
46
g_keyring.add(*g_conf.entity_name, ea);
47
} else if (strlen(g_conf.keyfile)) {
49
int fd = ::open(g_conf.keyfile, O_RDONLY);
51
cerr << "unable to open " << g_conf.keyfile << ": " << strerror(errno) << std::endl;
54
int len = ::read(fd, buf, sizeof(buf));
56
cerr << "unable to read key from " << g_conf.keyfile << ": " << strerror(errno) << std::endl;
64
ea.key.decode_base64(k);
65
g_keyring.add(*g_conf.entity_name, ea);