mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-26 13:41:02 +02:00
Migrated Gateway to new API
This commit is contained in:
parent
7e3c66a06b
commit
2e3670206a
1 changed files with 13 additions and 0 deletions
|
|
@ -10,6 +10,7 @@ import logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from trustgraph.base.logging import setup_logging
|
from trustgraph.base.logging import setup_logging
|
||||||
|
from trustgraph.base.pubsub import get_pubsub
|
||||||
|
|
||||||
from . auth import Authenticator
|
from . auth import Authenticator
|
||||||
from . config.receiver import ConfigReceiver
|
from . config.receiver import ConfigReceiver
|
||||||
|
|
@ -50,6 +51,10 @@ class Api:
|
||||||
|
|
||||||
self.pulsar_listener = config.get("pulsar_listener", None)
|
self.pulsar_listener = config.get("pulsar_listener", None)
|
||||||
|
|
||||||
|
# Create backend using factory
|
||||||
|
self.pubsub_backend = get_pubsub(**config)
|
||||||
|
|
||||||
|
# Keep pulsar_client for backward compatibility with existing gateway code
|
||||||
if self.pulsar_api_key:
|
if self.pulsar_api_key:
|
||||||
self.pulsar_client = pulsar.Client(
|
self.pulsar_client = pulsar.Client(
|
||||||
self.pulsar_host, listener_name=self.pulsar_listener,
|
self.pulsar_host, listener_name=self.pulsar_listener,
|
||||||
|
|
@ -174,6 +179,14 @@ def run():
|
||||||
help='Service identifier for logging and metrics (default: api-gateway)',
|
help='Service identifier for logging and metrics (default: api-gateway)',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Pub/sub backend selection
|
||||||
|
parser.add_argument(
|
||||||
|
'--pubsub-backend',
|
||||||
|
default=os.getenv('PUBSUB_BACKEND', 'pulsar'),
|
||||||
|
choices=['pulsar', 'mqtt'],
|
||||||
|
help='Pub/sub backend (default: pulsar, env: PUBSUB_BACKEND)',
|
||||||
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-p', '--pulsar-host',
|
'-p', '--pulsar-host',
|
||||||
default=default_pulsar_host,
|
default=default_pulsar_host,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue