/proc/self/cwd/source/extensions/filters/network/wasm/config.cc
Line | Count | Source (jump to first uncovered line) |
1 | | #include "source/extensions/filters/network/wasm/config.h" |
2 | | |
3 | | #include "envoy/extensions/filters/network/wasm/v3/wasm.pb.validate.h" |
4 | | #include "envoy/registry/registry.h" |
5 | | |
6 | | #include "source/common/common/empty_string.h" |
7 | | #include "source/common/config/datasource.h" |
8 | | #include "source/extensions/common/wasm/wasm.h" |
9 | | #include "source/extensions/filters/network/wasm/wasm_filter.h" |
10 | | |
11 | | namespace Envoy { |
12 | | namespace Extensions { |
13 | | namespace NetworkFilters { |
14 | | namespace Wasm { |
15 | | |
16 | | Network::FilterFactoryCb WasmFilterConfig::createFilterFactoryFromProtoTyped( |
17 | | const envoy::extensions::filters::network::wasm::v3::Wasm& proto_config, |
18 | 0 | Server::Configuration::FactoryContext& context) { |
19 | 0 | context.api().customStatNamespaces().registerStatNamespace( |
20 | 0 | Extensions::Common::Wasm::CustomStatNamespace); |
21 | 0 | auto filter_config = std::make_shared<FilterConfig>(proto_config, context); |
22 | 0 | return [filter_config](Network::FilterManager& filter_manager) -> void { |
23 | 0 | auto filter = filter_config->createFilter(); |
24 | 0 | if (filter) { |
25 | 0 | filter_manager.addFilter(filter); |
26 | 0 | } // else fail open |
27 | 0 | }; |
28 | 0 | } |
29 | | |
30 | | /** |
31 | | * Static registration for the Wasm filter. @see RegisterFactory. |
32 | | */ |
33 | | REGISTER_FACTORY(WasmFilterConfig, Server::Configuration::NamedNetworkFilterConfigFactory); |
34 | | |
35 | | } // namespace Wasm |
36 | | } // namespace NetworkFilters |
37 | | } // namespace Extensions |
38 | | } // namespace Envoy |