From b7c56d11f2aea594613ad952001207b75aa87452 Mon Sep 17 00:00:00 2001 From: Vladimir Svacko Date: Wed, 28 Jan 2026 16:13:32 +0100 Subject: [PATCH] fix: additional found env variables added --- README.md | 76 ++++++++++++++++++++++++++++++-------- readme.improvement.plan.md | 11 +----- 2 files changed, 62 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index b3ecb57..8214a5c 100644 --- a/README.md +++ b/README.md @@ -77,21 +77,23 @@ LOG_LEVELS=info ### Environment Variable Details -| Variable | Description | Default | -|----------|-------------|---------| -| `ZABBIX_BASE_URL` | URL to your Zabbix server (include `/zabbix` path) | - | -| `ZABBIX_AUTH_TOKEN` | Zabbix Super Admin API token for administrative operations (full permissions needed for import/export operations) | - | -| `ZABBIX_AUTH_TOKEN_FOR_REQUESTS` | Token used for automated requests (can be same as ZABBIX_AUTH_TOKEN or a different token with limited permissions for routine operations) | - | -| `ZABBIX_EDGE_DEVICE_BASE_GROUP` | Base group for edge devices | - | -| `ZABBIX_ROADWORK_BASE_GROUP` | Base group for roadwork devices | - | -| `ZABBIX_PERMISSION_TEMPLATE_GROUP_NAME_PREFIX` | Prefix for permission template groups (used to identify permission-related template groups in Zabbix) | `Permissions` | -| `SCHEMA_PATH` | Path to schema files | `./schema/` | -| `ADDITIONAL_SCHEMAS` | Comma-separated list of additional schema files | - | -| `ADDITIONAL_RESOLVERS` | Comma-separated list of resolver types to generate | - | -| `LOG_LEVELS` | Log level configuration | - | -| `DRY_RUN` | If set, runs in dry run mode without starting the server (exits immediately after initialization, useful for testing configuration) | - | -| `HOST_TYPE_FILTER_DEFAULT` | Default filter for host types | - | -| `HOST_GROUP_FILTER_DEFAULT` | Default filter for host groups | - | +| Variable | Description | Default | Required | +|----------|-------------|---------|----------| +| `ZABBIX_BASE_URL` | URL to your Zabbix server (include `/zabbix` path) | - | Yes | +| `ZABBIX_AUTH_TOKEN` | Zabbix Super Admin API token for administrative operations (full permissions needed for import/export operations) | - | Yes | +| `ZABBIX_AUTH_TOKEN_FOR_REQUESTS` | Token used for automated requests (can be same as ZABBIX_AUTH_TOKEN or a different token with limited permissions for routine operations) | - | Yes* | +| `ZABBIX_EDGE_DEVICE_BASE_GROUP` | Base group for edge devices | - | No | +| `ZABBIX_ROADWORK_BASE_GROUP` | Base group for roadwork devices | - | No | +| `ZABBIX_PERMISSION_TEMPLATE_GROUP_NAME_PREFIX` | Prefix for permission template groups (used to identify permission-related template groups in Zabbix) | `Permissions` | No | +| `SCHEMA_PATH` | Path to schema files | `./schema/` | No | +| `ADDITIONAL_SCHEMAS` | Comma-separated list of additional schema files | - | No | +| `ADDITIONAL_RESOLVERS` | Comma-separated list of resolver types to generate | - | No | +| `LOG_LEVELS` | Log level configuration | - | No | +| `DRY_RUN` | If set, runs in dry run mode without starting the server (exits immediately after initialization, useful for testing configuration) | - | No | +| `HOST_TYPE_FILTER_DEFAULT` | Default filter for host types | - | No | +| `HOST_GROUP_FILTER_DEFAULT` | Default filter for host groups | - | No | + +*Note: `ZABBIX_AUTH_TOKEN_FOR_REQUESTS` is required when different from `ZABBIX_AUTH_TOKEN`, otherwise the same token will be used for all operations. ### Authentication Tokens Explanation @@ -103,6 +105,50 @@ The API supports two different authentication tokens for security separation: The `ZABBIX_EDGE_DEVICE_BASE_GROUP` (or `ZABBIX_ROADWORK_BASE_GROUP`) is used to create a regex pattern `FIND_ZABBIX_EDGE_DEVICE_BASE_GROUP_PREFIX` that identifies edge device groups in Zabbix. This pattern follows the format `^(${ZABBIX_EDGE_DEVICE_BASE_GROUP})\/` and is used to filter and process edge device related data. +### Configuration Examples + +#### Development Configuration (.env.development) +```bash +# Zabbix connection +ZABBIX_BASE_URL=http://localhost:8080/zabbix +ZABBIX_AUTH_TOKEN=your-dev-super-admin-token +ZABBIX_AUTH_TOKEN_FOR_REQUESTS=your-dev-super-admin-token + +# Optional configuration for development +ZABBIX_EDGE_DEVICE_BASE_GROUP=DevEdge +ZABBIX_ROADWORK_BASE_GROUP=DevRoadwork +ZABBIX_PERMISSION_TEMPLATE_GROUP_NAME_PREFIX=Permissions +SCHEMA_PATH=./schema/ +LOG_LEVELS=debug + +# Dynamic schema extension (optional) +ADDITIONAL_SCHEMAS=./schema/extensions/display_devices.graphql,./schema/extensions/location_tracker_devices.graphql +ADDITIONAL_RESOLVERS=SinglePanelDevice,FourPanelDevice,DistanceTrackerDevice +``` + +#### Production Configuration (.env.production) +```bash +# Zabbix connection +ZABBIX_BASE_URL=https://zabbix.company.com/zabbix +ZABBIX_AUTH_TOKEN=your-prod-super-admin-token +ZABBIX_AUTH_TOKEN_FOR_REQUESTS=your-prod-read-only-token + +# Production configuration +ZABBIX_EDGE_DEVICE_BASE_GROUP=ProductionEdge +ZABBIX_ROADWORK_BASE_GROUP=ProductionRoadwork +ZABBIX_PERMISSION_TEMPLATE_GROUP_NAME_PREFIX=Permissions +SCHEMA_PATH=./schema/ +LOG_LEVELS=info + +# Dynamic schema extension for production +ADDITIONAL_SCHEMAS=/app/schema/extensions/display_devices.graphql,/app/schema/extensions/location_tracker_devices.graphql +ADDITIONAL_RESOLVERS=SinglePanelDevice,FourPanelDevice,DistanceTrackerDevice + +# Performance and operational settings +HOST_TYPE_FILTER_DEFAULT=device +HOST_GROUP_FILTER_DEFAULT=production +``` + ## ▶️ Running the Application ### Development Mode diff --git a/readme.improvement.plan.md b/readme.improvement.plan.md index dea7054..fb31dc0 100644 --- a/readme.improvement.plan.md +++ b/readme.improvement.plan.md @@ -5,16 +5,7 @@ ## Priority 2: Enhance Existing Sections - -### 2.2 Configuration Section -- Add a complete table of all environment variables with descriptions -- Include default values and required/optional status -- Add examples of production vs development configurations - -### 2.3 Schema Relationship Section -- Create a mapping table between Zabbix entities and GraphQL types -- Explain how Zabbix host groups, templates, and items relate to GraphQL objects -- Add information about the Location type and its usage + ## Priority 3: Add New Sections