Skip to content
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

Add support for new configs including advertised_port and use_secured_proxy #20

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 @@ -30,6 +30,8 @@
"group_id": "schema-registry",
"host": "127.0.0.1",
"port": 8081,
"advertised_port": None,
"use_secured_proxy": False,
"server_tls_certfile": None,
"server_tls_keyfile": None,
"registry_host": "127.0.0.1",
Expand Down
6 changes: 5 additions & 1 deletion karapace/kafka_rest_apis/consumer_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@
class ConsumerManager:
def __init__(self, config: dict) -> None:
self.config = config
self.hostname = f"http://{self.config['advertised_hostname']}:{self.config['port']}"
self.protocol = "https" if self.config["use_secured_proxy"] else "http"
if self.config["advertised_port"] is None:
self.hostname = f"{self.protocol}://{self.config['advertised_hostname']}:{self.config['port']}"
else:
self.hostname = f"{self.protocol}://{self.config['advertised_hostname']}:{self.config['advertised_port']}"
self.log = logging.getLogger("RestConsumerManager")
self.deserializer = SchemaRegistryDeserializer(config=config)
self.consumers = {}
Expand Down