in src/smspark/nginx_utils.py [0:0]
def write_nginx_default_conf(remote_domain_name: Optional[str]) -> None:
"""Inject NGINX config value and write NGINX config file.
When running spark history behind notebook proxy, the domain will change because of
the redirect behavior of spark itself, which ignores the proxy. Nginx can't easily
support env variable. Here we inject env variable to the default.conf file.
"""
if remote_domain_name is not None:
with open(NGINX_DEFAULT_CONFIG_PATH, "a") as ngxin_conf:
ngxin_conf.write(NGINX_ENV_VARIABLE_CONFIG_FORMAT.format(remote_domain_name))
else:
with open(NGINX_DEFAULT_CONFIG_PATH, "a") as ngxin_conf:
ngxin_conf.write(NGINX_ENV_VARIABLE_CONFIG_FORMAT.format(DOMAIN_LOCALHOST))