|
| 1 | +# Configuration |
| 2 | + |
| 3 | +DetectMateService can be configured using a YAML settings file or environment variables. Environment variables take precedence over the YAML file. |
| 4 | + |
| 5 | +## Service settings |
| 6 | + |
| 7 | +These settings control the service infrastructure. |
| 8 | + |
| 9 | +| Setting | Env Variable | Default | Description | |
| 10 | +| :---------------------------- | :--------------------------------------- | :--------------------------------- |:----------------------------------------------------------------------------------------------------------| |
| 11 | +| `component_name` | `DETECTMATE_COMPONENT_NAME` | `None` | A human-readable name for the service instance. | |
| 12 | +| `component_id` | `DETECTMATE_COMPONENT_ID` | `None` (computed) | Unique identifier for the component; computed automatically if not provided. | |
| 13 | +| `component_type` | `DETECTMATE_COMPONENT_TYPE` | `core` | Python import path for the component class (e.g., `detectors.MyDetector`). | |
| 14 | +| `component_config_class` | `DETECTMATE_COMPONENT_CONFIG_CLASS` | `None` | Python import path of the configuration class used by the component (e.g., `detectors.MyDetectorConfig`). | |
| 15 | +| `log_level` | `DETECTMATE_LOG_LEVEL` | `INFO` | Logging level (`DEBUG`, `INFO`, `WARNING`, `ERROR`). | |
| 16 | +| `log_dir` | `DETECTMATE_LOG_DIR` | `./logs` | Directory for log files. | |
| 17 | +| `log_to_console` | `DETECTMATE_LOG_TO_CONSOLE` | `true` | Whether logs are written to stdout/stderr. | |
| 18 | +| `log_to_file` | `DETECTMATE_LOG_TO_FILE` | `true` | Whether logs are written to files in `log_dir`. | |
| 19 | +| `manager_addr` | `DETECTMATE_MANAGER_ADDR` | `ipc:///tmp/detectmate.cmd.ipc` | Address for management commands (REQ/REP). | |
| 20 | +| `manager_recv_timeout` | `DETECTMATE_MANAGER_RECV_TIMEOUT` | `100` | Receive timeout (ms) for the manager command channel. | |
| 21 | +| `manager_thread_join_timeout` | `DETECTMATE_MANAGER_THREAD_JOIN_TIMEOUT` | `1.0` | Timeout (s) when waiting for the manager thread to stop. | |
| 22 | +| `engine_addr` | `DETECTMATE_ENGINE_ADDR` | `ipc:///tmp/detectmate.engine.ipc` | Address for data processing (PAIR0/1). | |
| 23 | +| `engine_autostart` | `DETECTMATE_ENGINE_AUTOSTART` | `true` | Whether the engine channel is started automatically. | |
| 24 | +| `engine_recv_timeout` | `DETECTMATE_ENGINE_RECV_TIMEOUT` | `100` | Receive timeout (ms) for the engine channel. | |
| 25 | +| `out_addr` | `DETECTMATE_OUT_ADDR` | `[]` | List of output addresses (strongly typed NNG URLs). | |
| 26 | +| `out_dial_timeout` | `DETECTMATE_OUT_DIAL_TIMEOUT` | `1000` | Timeout (ms) for connecting to output addresses. | |
| 27 | + |
| 28 | + |
| 29 | +### YAML files |
| 30 | + |
| 31 | +You can provide a YAML file containing the service settings. Below is an example `settings.yaml`: |
| 32 | + |
| 33 | +```yaml |
| 34 | +component_name: "my-detector" |
| 35 | +log_level: "DEBUG" |
| 36 | +log_dir: "./logs" |
| 37 | + |
| 38 | +# Manager Interface (Command Channel) |
| 39 | +manager_addr: "ipc:///tmp/detectmate.cmd.ipc" |
| 40 | + |
| 41 | +# Engine Interface (Data Channel) |
| 42 | +engine_addr: "ipc:///tmp/detectmate.engine.ipc" |
| 43 | +engine_autostart: true |
| 44 | + |
| 45 | +# Output Destinations (where processed data is sent) |
| 46 | +out_addr: |
| 47 | + - "tcp://127.0.0.1:5000" |
| 48 | + - "ipc:///tmp/output.ipc" |
| 49 | + |
| 50 | +out_dial_timeout: 1000 |
| 51 | +``` |
| 52 | +
|
| 53 | +
|
| 54 | +### Environment variables |
| 55 | +
|
| 56 | +Environment variables override values in the YAML file. They are prefixed with `DETECTMATE_`. |
| 57 | + |
| 58 | +Example: |
| 59 | +```bash |
| 60 | +export DETECTMATE_LOG_LEVEL=DEBUG |
| 61 | +export DETECTMATE_COMPONENT_NAME=worker-1 |
| 62 | +detectmate start |
| 63 | +``` |
| 64 | + |
| 65 | +## Component configuration |
| 66 | + |
| 67 | +In addition to the service settings (which configure the *runner*), you can also pass a separate configuration file for the specific component logic (e.g., detector parameters) using the `--config` flag in the CLI. This file is specific to the implementation of the component you are running. |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | +```yaml |
| 72 | +# detector-config.yaml |
| 73 | +threshold: 0.85 |
| 74 | +sensitivity: high |
| 75 | +enabled: true |
| 76 | +``` |
| 77 | + |
| 78 | +You can read more about Components in the [Using a Library Component](library.md) section. |
0 commit comments