userver: userver/utils/daemon_run.hpp Source File
Loading...
Searching...
No Matches
daemon_run.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/utils/daemon_run.hpp
4/// @brief Functions to start a daemon with specified components list.
5
6#include <userver/components/component_list.hpp>
7#include <userver/components/run.hpp>
8
9namespace boost::program_options {
10class options_description;
11class variables_map;
12} // namespace boost::program_options
13
14USERVER_NAMESPACE_BEGIN
15
16namespace utils {
17
18/// @returns default options of DaemonMain
19///
20/// List of options:
21/// * --help - show all command line arguments
22/// * --config CONFIG - path to config.yaml
23/// * --config_vars CONFIG_VARS - path to config_vars.yaml
24/// * --config_vars_override CONFIG_VARS - path to config_vars.override.yaml
25/// * --print-config-schema - print config.yaml YAML Schema
26/// * --print-dynamic-config-defaults - print JSON with dynamic config defaults
27boost::program_options::options_description BaseRunOptions();
28
29/// Parses command line arguments and calls components::Run with config file
30/// from --config parameter. See BaseRunOptions() for a list of options.
31/// Reports unhandled exceptions.
32int DaemonMain(int argc, const char* const argv[], const components::ComponentList& components_list);
33
34/// Calls components::Run with config file from --config parameter.
35/// Reports unhandled exceptions.
36int DaemonMain(const boost::program_options::variables_map& vm, const components::ComponentList& components_list);
37
38/// Calls components::Run with in-memory config.
39/// Reports unhandled exceptions.
40int DaemonMain(const components::InMemoryConfig& config, const components::ComponentList& components_list);
41
42} // namespace utils
43
44USERVER_NAMESPACE_END