Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 33 additions & 7 deletions src/ros2_medkit_gateway/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,22 @@ cors:

> ⚠️ **Security Note:** Using `["*"]` as `allowed_origins` is not recommended for production. When `allow_credentials` is `true`, wildcard origins will cause the application to fail to start with an exception.

**Use config from another package (`gateway.launch.py`):**

```bash
ros2 launch ros2_medkit_gateway gateway.launch.py \
config_file:=<your_package>/config/gateway_params.yaml
```

> **Parameter priority:** launch args > `config_file` > packaged defaults. `config_file` overrides only the keys it defines; `server_host`, `server_port`, and `refresh_interval_ms` are launch-arg only and always take precedence.

| Launch Argument | Default | Description |
| --------------------- | ------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| `config_file` | packaged `config/gateway_params.yaml` | Path to a YAML parameter file applied on top of the packaged defaults. |
| `server_host` | `127.0.0.1` | Host to bind the REST server (`127.0.0.1` or `0.0.0.0`). Launch-arg only. |
| `server_port` | `8080` | Port for the REST API. Launch-arg only. |
| `refresh_interval_ms` | `30000` | Safety-backstop refresh interval in ms (graph events drive the primary refresh). Launch-arg only. |

### Authentication Configuration Examples

**Enable authentication with write-only protection (recommended for development):**
Expand Down Expand Up @@ -1402,13 +1418,23 @@ ros2 launch ros2_medkit_gateway gateway_https.launch.py cert_dir:=/home/user/cer
ros2 launch ros2_medkit_gateway gateway_https.launch.py min_tls_version:=1.3
```

| Launch Argument | Default | Description |
| --------------------- | -------------------------- | ------------------------------------------------ |
| `cert_dir` | `/tmp/ros2_medkit_certs` | Directory for auto-generated certificates |
| `server_host` | `127.0.0.1` | Host to bind HTTPS server |
| `server_port` | `8443` | Port for HTTPS API |
| `min_tls_version` | `1.2` | Minimum TLS version (`1.2` or `1.3`) |
| `refresh_interval_ms` | `30000` | Safety-backstop refresh interval (graph events drive primary refresh) |
**Use config from another package (`gateway_https.launch.py`):**

```bash
ros2 launch ros2_medkit_gateway gateway_https.launch.py \
config_file:=<your_package>/config/gateway_params.yaml
```

> **Parameter priority:** launch args > `config_file` > packaged defaults. `config_file` overrides only the keys it defines; `cert_dir`, `server_host`, `server_port`, `min_tls_version`, and `refresh_interval_ms` are launch-arg only and always take precedence.

| Launch Argument | Default | Description |
| --------------------- | ------------------------------------- | ---------------------------------------------------------------------------------------- |
| `config_file` | packaged `config/gateway_params.yaml` | Path to a YAML parameter file applied on top of the packaged defaults. |
| `cert_dir` | `/tmp/ros2_medkit_certs` | Directory for auto-generated certificates. Launch-arg only. |
| `server_host` | `127.0.0.1` | Host to bind HTTPS server. Launch-arg only. |
| `server_port` | `8443` | Port for HTTPS API. Launch-arg only. |
| `min_tls_version` | `1.2` | Minimum TLS version (`1.2` or `1.3`). Launch-arg only. |
| `refresh_interval_ms` | `30000` | Safety-backstop refresh interval (graph events drive primary refresh). Launch-arg only. |

**Usage with curl (self-signed certs):**
```bash
Expand Down
8 changes: 7 additions & 1 deletion src/ros2_medkit_gateway/launch/gateway.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ def generate_launch_description():
f'{graph_provider_path} - plugin will not load')
graph_provider_path = ''

declare_override_config_arg = DeclareLaunchArgument(
'config_file', default_value=default_config,
description='Path to YAML config file to override gateway parameters. Default config '
'is the ros2_medkit_gateway/config/gateway_params.yaml.')

declare_host_arg = DeclareLaunchArgument(
'server_host', default_value='127.0.0.1',
description='Host to bind REST server (127.0.0.1 or 0.0.0.0)')
Expand Down Expand Up @@ -74,10 +79,11 @@ def generate_launch_description():
executable='gateway_node',
name='ros2_medkit_gateway',
output='screen',
parameters=[default_config, param_overrides],
parameters=[default_config, LaunchConfiguration('config_file'), param_overrides],
arguments=['--ros-args', '--log-level', 'info'])

return LaunchDescription([
declare_override_config_arg,
declare_host_arg,
declare_port_arg,
declare_refresh_arg,
Expand Down
11 changes: 10 additions & 1 deletion src/ros2_medkit_gateway/launch/gateway_https.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def launch_setup(context):
server_port = LaunchConfiguration('server_port').perform(context)
refresh_interval = LaunchConfiguration('refresh_interval_ms').perform(context)
min_tls_version = LaunchConfiguration('min_tls_version').perform(context)
override_config = LaunchConfiguration('config_file').perform(context)

# Use temp directory if not specified
if not cert_dir:
Expand Down Expand Up @@ -181,7 +182,7 @@ def launch_setup(context):
name='ros2_medkit_gateway',
output='screen',
parameters=[
default_config,
default_config, override_config,
{
'server.host': server_host,
'server.port': int(server_port),
Expand Down Expand Up @@ -237,6 +238,14 @@ def generate_launch_description():
description='Minimum TLS version (1.2 or 1.3)'
),

DeclareLaunchArgument(
'config_file', default_value=os.path.join(
get_package_share_directory('ros2_medkit_gateway'),
'config', 'gateway_params.yaml'),
description='Path to YAML config file to override gateway parameters. Default config '
'is the ros2_medkit_gateway/config/gateway_params.yaml.'
),

# Use OpaqueFunction to generate certs and set up node
OpaqueFunction(function=launch_setup),
])
Loading