forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathruntime_utility.cc
38 lines (34 loc) · 1.34 KB
/
runtime_utility.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "source/common/config/runtime_utility.h"
#include "envoy/config/bootstrap/v3/bootstrap.pb.h"
namespace Envoy {
namespace Config {
void translateRuntime(const envoy::config::bootstrap::v3::Runtime& runtime_config,
envoy::config::bootstrap::v3::LayeredRuntime& layered_runtime_config) {
{
auto* layer = layered_runtime_config.add_layers();
layer->set_name("base");
layer->mutable_static_layer()->MergeFrom(runtime_config.base());
}
if (!runtime_config.symlink_root().empty()) {
{
auto* layer = layered_runtime_config.add_layers();
layer->set_name("root");
layer->mutable_disk_layer()->set_symlink_root(runtime_config.symlink_root());
layer->mutable_disk_layer()->set_subdirectory(runtime_config.subdirectory());
}
if (!runtime_config.override_subdirectory().empty()) {
auto* layer = layered_runtime_config.add_layers();
layer->set_name("override");
layer->mutable_disk_layer()->set_symlink_root(runtime_config.symlink_root());
layer->mutable_disk_layer()->set_subdirectory(runtime_config.override_subdirectory());
layer->mutable_disk_layer()->set_append_service_cluster(true);
}
}
{
auto* layer = layered_runtime_config.add_layers();
layer->set_name("admin");
layer->mutable_admin_layer();
}
}
} // namespace Config
} // namespace Envoy