Skip to content

Commit

Permalink
server_name added
Browse files Browse the repository at this point in the history
  • Loading branch information
Abuelodelanada committed Dec 15, 2023
1 parent 482fd0c commit 563d632
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __init__(self, *args):
tls_requirer=self.server_cert,
)

self.nginx = Nginx(cluster_provider=self.cluster_provider)
self.nginx = Nginx(cluster_provider=self.cluster_provider, server_name=self.hostname)
self.framework.observe(
self.on.nginx_pebble_ready, # pyright: ignore
self._on_nginx_pebble_ready,
Expand Down
5 changes: 3 additions & 2 deletions src/nginx.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,10 @@ class Nginx:

config_path = NGINX_CONFIG

def __init__(self, cluster_provider: MimirClusterProvider, *args):
def __init__(self, cluster_provider: MimirClusterProvider, server_name: str, *args):
super().__init__(*args)
self.cluster_provider = cluster_provider
self.server_name = server_name

def config(self, tls: bool = False) -> str:
"""Build and return the Nginx configuration."""
Expand Down Expand Up @@ -334,7 +335,7 @@ def _server(self, addresses_by_role: Dict[str, Set[str]], tls: bool = False) ->
"args": ["X-Scope-OrgID", "$ensured_x_scope_orgid"],
},
# FIXME: use a suitable SERVER_NAME
{"directive": "server_name", "args": ["SERVER_NAME"]},
{"directive": "server_name", "args": [self.server_name]},
{"directive": "ssl_certificate", "args": [CERT_PATH]},
{"directive": "ssl_certificate_key", "args": [KEY_PATH]},
{"directive": "ssl_protocols", "args": ["TLSv1", "TLSv1.1", "TLSv1.2"]},
Expand Down

0 comments on commit 563d632

Please sign in to comment.