def get_redirect_config(): return get_config( options=SSL_REDIRECT_OPTIONS if settings.PROXIES_CONFIG.ssl_enabled else "", indent=0, ssl_path=settings.PROXIES_CONFIG.ssl_path, )
def get_static_proxy_config(): return get_config( options=STATIC_PROXY_OPTIONS, indent=0, service=settings.PROXIES_CONFIG.static_url.rstrip("/") + "/", ssl_server_name=get_ssl_server_name(settings.PROXIES_CONFIG.static_url), )
def get_api_location_config(resolver: str, auth=str): service = get_service_url( host=settings.PROXIES_CONFIG.api_host, port=settings.PROXIES_CONFIG.api_port, ) if not settings.PROXIES_CONFIG.auth_external: auth = "" return get_config(options=OPTIONS, service=service, resolver=resolver, auth=auth)
def get_api_config(path: str, intercept_errors: str = "on"): return get_config( options=UWSGI_OPTIONS, indent=0, path=path, intercept_errors=intercept_errors, )
def get_streams_location_config(resolver: str, auth: str): service = get_service_url( host=settings.PROXIES_CONFIG.streams_host, port=settings.PROXIES_CONFIG.streams_port, ) return get_config(options=OPTIONS, resolver=resolver, auth=auth, service=service)
def get_plugin_location_config(name: str, port: int, resolver: str, auth: str): return get_config( options=PLUGIN_OPTIONS, indent=0, plugin_name=name, port=port, resolver=resolver, auth=auth, )
def get_auth_location_config(resolver: str): service = settings.PROXIES_CONFIG.auth_external or get_service_url( host=settings.PROXIES_CONFIG.api_host, port=settings.PROXIES_CONFIG.api_port, ) if not settings.PROXIES_CONFIG.auth_use_resolver: resolver = "" return get_config( options=AUTH_LOCATION_CONFIG if settings.PROXIES_CONFIG.auth_enabled else "", indent=0, service=service, auth_api=AUTH_API, resolver=resolver, )
def get_services_location_config(resolver: str, auth: str, rewrite: bool = False): dns_cluster_with_port = settings.PROXIES_CONFIG.dns_custom_cluster if settings.PROXIES_CONFIG.services_port != 80: dns_cluster_with_port = "{}:{}".format( dns_cluster_with_port, settings.PROXIES_CONFIG.services_port ) return get_config( options=SERVICES_REWRITE_OPTIONS if rewrite else SERVICES_OPTIONS, resolver=resolver, auth=auth, dns_cluster_with_port=dns_cluster_with_port, )
def get_api_location_config(resolver: str, auth=str): service = get_service_url( host=settings.PROXIES_CONFIG.api_host, port=settings.PROXIES_CONFIG.api_port, ) if not settings.PROXIES_CONFIG.api_use_resolver: resolver = "" if not settings.PROXIES_CONFIG.auth_external: auth = "" return get_config( options=OPTIONS, service=service, resolver=resolver, auth=auth, ssl_server_name=get_ssl_server_name(service), header_host=get_header_host(service), )
def get_api_config( path: str, service: str, resolver: str, auth: str, ssl_server_name: str, header_host: str, ): return get_config( options=OPTIONS, path=path, service=service, resolver=resolver, auth=auth, ssl_server_name=ssl_server_name, header_host=header_host, )
def get_api_config(path: str): return get_config(options=UWSGI_OPTIONS, indent=0, path=path,)
def get_static_location_config(): return get_config( options=STATIC_LOCATION_OPTIONS, indent=0, static_root=settings.PROXIES_CONFIG.static_root.rstrip("/") + "/", )
def get_gunicorn_config(): return get_config(options=GUNICORN_OPTIONS, indent=0, intercept_errors="off")
def get_auth_config(): return get_config( options=AUTH_OPTIONS if settings.PROXIES_CONFIG.auth_enabled else "", indent=0, auth_api=AUTH_V1_LOCATION, )
def get_favicon_config(): return get_config(options=OPTIONS, indent=0)
def get_archives_root_location_config(): return get_config( options=ARCHIVES_LOCATION_OPTIONS, indent=0, archives_root=settings.PROXIES_CONFIG.archive_root.rstrip("/") + "/", )
def get_listen_config(is_proxy: bool, port=80) -> str: options = (SSL_OPTIONS if is_proxy and settings.PROXIES_CONFIG.ssl_enabled else HTTP_OPTIONS) return get_config(options=options, indent=0, port=port)
def get_logging_config(): return get_config(options=OPTIONS, indent=0, level=settings.PROXIES_CONFIG.log_level)
def get_timeout_config(): return get_config(options=OPTIONS, indent=0, timeout=settings.PROXIES_CONFIG.nginx_timeout)
def get_gzip_config(): return get_config(options=OPTIONS, indent=0)
def get_static_location_config(): return get_config(options=STATIC_LOCATION_OPTIONS, indent=0)
def get_logging_config(): log_level = settings.PROXIES_CONFIG.log_level if log_level and log_level.lower() == "warning": log_level = "warn" return get_config(options=OPTIONS, indent=0, level=log_level)
def get_tmp_location_config(): return get_config(options=TMP_LOCATION_OPTIONS, indent=0)
def get_ssl_config(): return get_config(options=SSL_OPTIONS, indent=0, ssl_path=settings.PROXIES_CONFIG.ssl_path)
def get_main_config(root=None): root = root or "/polyaxon" return get_config(options=OPTIONS, indent=0, root=root)
def get_error_page_config(): return get_config(options=OPTIONS, indent=0)
def get_gunicorn_config(): return get_config(options=UWSGI_OPTIONS, indent=0)
def get_healthz_location_config(): return get_config( options=HEALTHZ_LOCATION_OPTIONS, indent=0, )
def get_buffering_config(): return get_config(options=OPTIONS, indent=0)
def get_charset_config(): return get_config(options=OPTIONS, indent=0)