GatewayRuntime builds and owns the F4 object graph (CertProvider/pool -> WriteEngine/NatsWriteConsumer -> ActiveReadEngine -> optional GrpcServer), reusing the existing ingestor's logger/notification_handler/metrics_controller and DataManager (CertProvider shares its Mongo connection instead of opening a second one). app.py starts it after prepare_ingestor, sweeps idle OPC connections each loop iteration, and stops it on shutdown. A NATS connect failure at startup is logged/notified but never crashes the app -- the read path keeps working and idle_sweep() retries the consumer start. ingestor.py needed no changes: data_manager is already reachable via ingestor.ingestor_manager.data_manager. Also documents the new MinIO/Postgres env vars this wiring reads (via sientia_do's build_postgres_config for Postgres) in .env.example, and updates test_app.py's fixture to mock GatewayConfig/GatewayRuntime so the existing app tests keep exercising only what they mocked before.
47 lines
1.1 KiB
Plaintext
47 lines
1.1 KiB
Plaintext
# Redis
|
|
REDIS_HOST="localhost"
|
|
REDIS_PORT="6379"
|
|
REDIS_USERNAME="redis_user"
|
|
REDIS_PASSWORD="redis_password"
|
|
|
|
# Pod
|
|
HOSTNAME="localhost"
|
|
POLL_INTERVAL="5"
|
|
LOG_LEVEL="DEBUG"
|
|
|
|
# Mongo DB
|
|
MONGODB_URL="localhost:27018"
|
|
MONGODB_USERNAME="mongo_user"
|
|
MONGODB_PASSWORD="mongo_password"
|
|
MONGODB_DATABASE="sientia"
|
|
|
|
# OPC Gateway
|
|
NATS_URL="nats://localhost:4222"
|
|
NATS_WRITE_SUBJECT="opc.write"
|
|
NATS_QUEUE="gateway-writers"
|
|
GRPC_ENABLED="false"
|
|
GRPC_PORT="50051"
|
|
CERT_BUCKET="sientia-dataops"
|
|
CERT_CACHE_DIR="/tmp/opc-certs"
|
|
WRITE_TIMESTAMP="true"
|
|
WRITE_QUALITY="true"
|
|
WRITE_MIN_PAUSE_S="0.0"
|
|
IDLE_CONN_MAX_S="300.0"
|
|
|
|
# OPC Gateway - MinIO (client cert storage, read by GatewayRuntime/CertProvider)
|
|
MINIO_ENDPOINT="localhost:9000"
|
|
MINIO_ACCESS_KEY="minioadmin"
|
|
MINIO_SECRET_KEY="minioadmin"
|
|
MINIO_SECURE="false"
|
|
|
|
# OPC Gateway - Postgres (write_status updates, read by GatewayRuntime/DataSink
|
|
# via sientia_do.utils.connectors_config.build_postgres_config)
|
|
POSTGRES_HOST="localhost"
|
|
POSTGRES_PORT="5432"
|
|
POSTGRES_USER="sientia"
|
|
POSTGRES_PASSWORD="sientia"
|
|
POSTGRES_DBNAME="sientia"
|
|
POSTGRES_MIN_CONNECTIONS="5"
|
|
POSTGRES_MAX_CONNECTIONS="20"
|
|
|