1 /* Copyright 2012-present Facebook, Inc. 2 * Licensed under the Apache License, Version 2.0 */ 3 #pragma once 4 5 void cfg_shutdown(void); 6 void cfg_set_arg(const char* name, const json_ref& val); 7 void cfg_load_global_config_file(void); 8 json_ref cfg_get_json(const char* name); 9 const char* cfg_get_string(const char* name, const char* defval); 10 json_int_t cfg_get_int(const char* name, json_int_t defval); 11 bool cfg_get_bool(const char* name, bool defval); 12 double cfg_get_double(const char* name, double defval); 13 #ifndef _WIN32 14 mode_t cfg_get_perms(const char* name, bool write_bits, bool execute_bits); 15 #endif 16 const char *cfg_get_trouble_url(void); 17 json_ref cfg_compute_root_files(bool* enforcing); 18 19 class Configuration { 20 json_ref local_; 21 22 public: 23 Configuration() = default; 24 explicit Configuration(const json_ref& local); 25 26 json_ref get(const char* name) const; 27 const char* getString(const char* name, const char* defval) const; 28 json_int_t getInt(const char* name, json_int_t defval) const; 29 bool getBool(const char* name, bool defval) const; 30 double getDouble(const char* name, double defval) const; 31 }; 32