From 116028bb0af53bd4b3d91acaa3adbe4037038c5e Mon Sep 17 00:00:00 2001 From: Gabriele Baldoni Date: Wed, 13 Nov 2024 14:05:45 +0100 Subject: [PATCH 1/2] chore: enable rest plugin only if in config or if --rest-http-port is passed Signed-off-by: Gabriele Baldoni --- zenohd/src/main.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/zenohd/src/main.rs b/zenohd/src/main.rs index e618b6f3db..2ccfc71e30 100644 --- a/zenohd/src/main.rs +++ b/zenohd/src/main.rs @@ -127,9 +127,8 @@ fn config_from_args(args: &Args) -> Config { if let Some(id) = &args.id { config.set_id(id.parse().unwrap()).unwrap(); } - // apply '--rest-http-port' to config only if explicitly set (overwriting config), - // or if no config file is set (to apply its default value) - if args.rest_http_port.is_some() || args.config.is_none() { + // apply '--rest-http-port' to config only if explicitly set (overwriting config) + if args.rest_http_port.is_some() { let value = args.rest_http_port.as_deref().unwrap_or("8000"); if !value.eq_ignore_ascii_case("none") { config From 47c4c0fbae84a92e8a81e40c41e4b7dc1afac634 Mon Sep 17 00:00:00 2001 From: Luca Cominardi Date: Thu, 5 Dec 2024 10:46:18 +0100 Subject: [PATCH 2/2] Update README with --rest-http-port option --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8020c2d0b2..58eb84f803 100644 --- a/README.md +++ b/README.md @@ -151,7 +151,7 @@ Zenoh's router is built as `target/release/zenohd`. All the examples are built i * run the Zenoh router with permission to perform config changes via the admin space, and with a memory storage: ```sh - ./target/release/zenohd --adminspace-permissions=rw --cfg='plugins/storage_manager/storages/demo:{key_expr:"demo/example/**",volume:"memory"}' + ./target/release/zenohd --rest-http-port=8000 --adminspace-permissions=rw --cfg='plugins/storage_manager/storages/demo:{key_expr:"demo/example/**",volume:"memory"}' ``` * in another shell, get info of the zenoh router via the zenoh admin space (you may use `jq` for pretty json formatting): @@ -246,11 +246,11 @@ By default the Zenoh router is delivered or built with 2 plugins. These may be c > [!WARNING] > Since `v0.6`, `zenohd` no longer loads every available plugin at startup. Instead, only configured plugins are loaded (after processing `--cfg` and `--plugin` options). Once `zenohd` is running, plugins can be hot-loaded and, if they support it, reconfigured at runtime by editing their configuration through the adminspace. -Note that the REST plugin is added to the configuration by the default value of the `--rest-http-port` CLI argument. - **[REST plugin](https://zenoh.io/docs/manual/plugin-http/)** (exposing a REST API): This plugin converts GET and PUT REST requests into Zenoh gets and puts respectively. +Note that to activate the REST plugin on `zenohd` the CLI argument should be passed: `--rest-http-port=8000` (or any other port of your choice). + **[Storages plugin](https://zenoh.io/docs/manual/plugin-storage-manager/)** (managing [backends and storages](https://zenoh.io/docs/manual/plugin-storage-manager/#backends-and-volumes)) This plugin allows you to easily define storages. These will store key-value pairs they subscribed to, and send the most recent ones when queried. Check out [DEFAULT_CONFIG.json5](DEFAULT_CONFIG.json5) for info on how to configure them.