feat: add Consul configuration to AMQAdapter class
This commit is contained in:
committed by
Stanislav Hejny (aider)
parent
dbfd5ea50d
commit
bd4272c30e
@@ -48,6 +48,26 @@ class AMQAdapter:
|
||||
# these 2 shall be provided by Docker swarm, format is a random alphanumeric string
|
||||
self.swarm_service_id = os.getenv("SWARM_SERVICE_ID", default="clever-amqp-service")
|
||||
self.swarm_task_id = os.getenv("SWARM_TASK_ID", default="python-adapter")
|
||||
#
|
||||
# Consul related configuration
|
||||
self.consul_port = config.getint(
|
||||
"CleverMicro-AMQ", self.PREFIX + "consul-port",
|
||||
fallback=int(os.getenv("CONSUL_PORT"), 10) if os.getenv("CONSUL_PORT") is not None else 8500
|
||||
)
|
||||
self.consul_host = config.get(
|
||||
"CleverMicro-AMQ",
|
||||
self.PREFIX + "consul-host",
|
||||
fallback="consul" if os.getenv("CONSUL_HOST") is None else os.getenv("CONSUL_HOST"),
|
||||
)
|
||||
self.consul_port = config.getint(
|
||||
"CleverMicro-AMQ", self.PREFIX + "consul-max-retries",
|
||||
fallback=int(os.getenv("CONSUL_MAX_RETRIES"), 10) if os.getenv("CONSUL_MAX_RETRIES") is not None else 5
|
||||
)
|
||||
self.consul_max_retries = config.getfloat(
|
||||
"CleverMicro-AMQ", self.PREFIX + "consul-initial-retry-delay",
|
||||
fallback=float(os.getenv("CONSUL_INITIAL_RETRY_DELAY"))
|
||||
if os.getenv("CONSUL_INITIAL_RETRY_DELAY") is not None else 0.2,
|
||||
)
|
||||
|
||||
def adapter_prefix(self) -> str:
|
||||
return f"{self.service_name}-{self.generator_id}-"
|
||||
|
||||
Reference in New Issue
Block a user