chore: centralize configuration management using a new Config class

- Replaced all direct `process.env` references with `Config` class constants.
- Added `dotenv` package to manage environment variables.
- Updated affected files, including schema loader, Zabbix API, resolvers, logging system, and integration points.
- Improved maintainability and consistency in environment variable handling.
This commit is contained in:
Andreas Hilbig 2026-01-27 17:28:22 +01:00
parent 6312c3a2f7
commit 2a8ff989f3
10 changed files with 95 additions and 72 deletions

View file

@ -58,6 +58,7 @@ import {ZABBIX_EDGE_DEVICE_BASE_GROUP, zabbixAPI} from "../datasources/zabbix-ap
import {GraphQLInterfaceType, GraphQLList} from "graphql/type/index.js";
import {isDevice} from "./resolver_helpers.js";
import {ZabbixPermissionsHelper} from "../datasources/zabbix-permissions.js";
import {Config} from "../common_utils.js";
export function createResolvers(): Resolvers {
@ -78,7 +79,7 @@ export function createResolvers(): Resolvers {
return dataSources.zabbixAPI.getLocations(zabbixAuthToken, new ParsedArgs(args));
},
apiVersion: () => {
return process.env.API_VERSION ?? "unknown"
return Config.API_VERSION ?? "unknown"
},
zabbixVersion: async () => {
return await new ZabbixRequest<string>("apiinfo.version").executeRequestThrowError(