userver: userver/components/run.hpp Source File
Loading...
Searching...
No Matches
run.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/components/run.hpp
4/// @brief Functions to start a service or tool with the specified
5/// config and components::ComponentList.
6
7#include <string>
8
9#include <userver/components/component_list.hpp>
10#include <userver/utils/strong_typedef.hpp>
11
12USERVER_NAMESPACE_BEGIN
13
14/// Contains functions and types to start a userver based service/tool.
15namespace components {
16
17/// Data type to distinguish config path and in-memory config values in
18/// components::Run() and components::RunOnce() functions.
21};
22
23/// Starts a server with the provided component list and config loaded from
24/// file. Reopens the logging files on SIGUSR1.
25///
26/// @see utils::DaemonMain
27void Run(const std::string& config_path,
28 const std::optional<std::string>& config_vars_path,
29 const std::optional<std::string>& config_vars_override_path,
30 const ComponentList& component_list);
31
32/// Starts a server with the provided component list and config.
33/// Reopens the logging files on SIGUSR1.
34///
35/// @see utils::DaemonMain
36void Run(const InMemoryConfig& config, const ComponentList& component_list);
37
38/// Runs the component list once with the config loaded from file.
39///
40/// @see utils::DaemonMain
41void RunOnce(const std::string& config_path,
42 const std::optional<std::string>& config_vars_path,
43 const std::optional<std::string>& config_vars_override_path,
44 const ComponentList& component_list);
45
46/// Runs the component list once with the config.
47///
48/// @see utils::DaemonMain
49void RunOnce(const InMemoryConfig& config, const ComponentList& component_list);
50
51namespace impl {
52
53// Composes a single static config schema from all components.
54std::string GetStaticConfigSchema(const ComponentList& component_list);
55
56std::string GetDynamicConfigDefaults();
57
58} // namespace impl
59
60} // namespace components
61
62USERVER_NAMESPACE_END