Skip to content

Add support for new configs including advertised_port and use_secured_proxy #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
2 changes: 2 additions & 0 deletions karapace/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"access_logs_debug": False,
"access_log_class": None,
"advertised_hostname": HOSTNAME,
"advertised_port": None,
"advertised_protocol": "http",
"bootstrap_uri": "127.0.0.1:9092",
"client_id": "sr-1",
"compatibility": "BACKWARD",
Expand Down
10 changes: 9 additions & 1 deletion karapace/kafka_rest_apis/consumer_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,15 @@ def new_name() -> str:
class ConsumerManager:
def __init__(self, config: dict) -> None:
self.config = config
self.hostname = f"http://{self.config['advertised_hostname']}:{self.config['port']}"
if self.config["advertised_port"] is None:
self.hostname = (
f"{self.config['advertised_protocol']}://{self.config['advertised_hostname']}:{self.config['port']}"
)
else:
self.hostname = (
f"{self.config['advertised_protocol']}://"
f"{self.config['advertised_hostname']}:{self.config['advertised_port']}"
)
self.deserializer = SchemaRegistryDeserializer(config=config)
self.consumers = {}
self.consumer_locks = defaultdict(Lock)
Expand Down