| 2069 | } |
| 2070 | |
| 2071 | int main(int argc, char** argv) { |
| 2072 | platformInit(); |
| 2073 | Error::init(); |
| 2074 | std::set_new_handler(&platform::outOfMemory); |
| 2075 | |
| 2076 | registerCrashHandler(); |
| 2077 | |
| 2078 | #ifdef __unixish__ |
| 2079 | struct sigaction act; |
| 2080 | |
| 2081 | // We don't want ctrl-c to quit |
| 2082 | sigemptyset(&act.sa_mask); |
| 2083 | act.sa_flags = 0; |
| 2084 | act.sa_handler = SIG_IGN; |
| 2085 | sigaction(SIGINT, &act, nullptr); |
| 2086 | #endif |
| 2087 | |
| 2088 | CLIOptions opt(argc, argv); |
| 2089 | if (opt.exit_code != -1) |
| 2090 | return opt.exit_code; |
| 2091 | |
| 2092 | if (opt.trace) { |
| 2093 | if (opt.traceDir.empty()) |
| 2094 | setNetworkOption(FDBNetworkOptions::TRACE_ENABLE); |
| 2095 | else |
| 2096 | setNetworkOption(FDBNetworkOptions::TRACE_ENABLE, StringRef(opt.traceDir)); |
| 2097 | |
| 2098 | if (!opt.traceFormat.empty()) { |
| 2099 | setNetworkOption(FDBNetworkOptions::TRACE_FORMAT, StringRef(opt.traceFormat)); |
| 2100 | } |
| 2101 | setNetworkOption(FDBNetworkOptions::ENABLE_SLOW_TASK_PROFILING); |
| 2102 | |
| 2103 | if (!opt.logGroup.empty()) { |
| 2104 | setNetworkOption(FDBNetworkOptions::TRACE_LOG_GROUP, StringRef(opt.logGroup)); |
| 2105 | } |
| 2106 | } |
| 2107 | initHelp(); |
| 2108 | |
| 2109 | // deferred TLS options |
| 2110 | if (opt.tlsCertPath.size()) { |
| 2111 | try { |
| 2112 | setNetworkOption(FDBNetworkOptions::TLS_CERT_PATH, opt.tlsCertPath); |
| 2113 | } catch (Error& e) { |
| 2114 | fprintf(stderr, "ERROR: cannot set TLS certificate path to `%s' (%s)\n", opt.tlsCertPath.c_str(), e.what()); |
| 2115 | return 1; |
| 2116 | } |
| 2117 | } |
| 2118 | |
| 2119 | if (opt.tlsCAPath.size()) { |
| 2120 | try { |
| 2121 | setNetworkOption(FDBNetworkOptions::TLS_CA_PATH, opt.tlsCAPath); |
| 2122 | } catch (Error& e) { |
| 2123 | fprintf(stderr, "ERROR: cannot set TLS CA path to `%s' (%s)\n", opt.tlsCAPath.c_str(), e.what()); |
| 2124 | return 1; |
| 2125 | } |
| 2126 | } |
| 2127 | if (opt.tlsKeyPath.size()) { |
| 2128 | try { |
nothing calls this directly
no test coverage detected