Integrate Druid activity into the Activities class, adding support for Druid configuration and initialization. Update worker and connectors configuration to accommodate Druid, enhancing data processing capabilities.
50 lines
1.5 KiB
Python
50 lines
1.5 KiB
Python
from os import getenv
|
|
|
|
|
|
def build_postgres_config():
|
|
return {
|
|
'host': getenv('POSTGRES_HOST', 'localhost'),
|
|
'port': int(getenv('POSTGRES_PORT', '5432')),
|
|
'user': getenv('POSTGRES_USER', 'sientia'),
|
|
'password': getenv('POSTGRES_PASSWORD', 'sientia'),
|
|
'dbname': getenv('POSTGRES_DBNAME', 'sientia'),
|
|
'min_connections': int(getenv('POSTGRES_MIN_CONNECTIONS', '5')),
|
|
'max_connections': int(getenv('POSTGRES_MAX_CONNECTIONS', '20'))
|
|
}
|
|
|
|
|
|
def build_kafka_config():
|
|
return {
|
|
'bootstrap_servers': getenv('KAFKA_BOOTSTRAP_SERVERS', 'localhost:9092'),
|
|
'polling_time': int(getenv('KAFKA_POLLING_TIME', '1000')),
|
|
'group_id': 'scouter-group'
|
|
}
|
|
|
|
|
|
def build_redis_config():
|
|
return {
|
|
'host': getenv('REDIS_HOST', 'localhost'),
|
|
'port': int(getenv('REDIS_PORT', '6379')),
|
|
'username': getenv('REDIS_USERNAME', None),
|
|
'password': getenv('REDIS_PASSWORD', None)
|
|
}
|
|
|
|
|
|
def build_mongodb_config():
|
|
username = getenv('MONGODB_USERNAME', 'sientia')
|
|
password = getenv('MONGODB_PASSWORD', 'sientia')
|
|
uri = getenv('MONGODB_URL', 'localhost:27017')
|
|
|
|
connection_string = f'mongodb://{username}:{password}@{uri}'
|
|
return {
|
|
'connection_string': connection_string,
|
|
'database_name': getenv('MONGODB_DATABASE_NAME', 'sientia')
|
|
}
|
|
|
|
|
|
def build_druid_config():
|
|
return {
|
|
'host': getenv('DRUID_HOST', 'localhost'),
|
|
'port': int(getenv('DRUID_PORT', '8082')),
|
|
}
|