Example #1
0
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,
    )
Example #2
0
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),
    )
Example #3
0
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)
Example #4
0
def get_api_config(path: str, intercept_errors: str = "on"):
    return get_config(
        options=UWSGI_OPTIONS,
        indent=0,
        path=path,
        intercept_errors=intercept_errors,
    )
Example #5
0
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)
Example #6
0
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,
    )
Example #7
0
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,
    )
Example #8
0
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,
    )
Example #9
0
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),
    )
Example #10
0
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,
    )
Example #11
0
def get_api_config(path: str):
    return get_config(options=UWSGI_OPTIONS, indent=0, path=path,)
Example #12
0
def get_static_location_config():
    return get_config(
        options=STATIC_LOCATION_OPTIONS,
        indent=0,
        static_root=settings.PROXIES_CONFIG.static_root.rstrip("/") + "/",
    )
Example #13
0
def get_gunicorn_config():
    return get_config(options=GUNICORN_OPTIONS,
                      indent=0,
                      intercept_errors="off")
Example #14
0
def get_auth_config():
    return get_config(
        options=AUTH_OPTIONS if settings.PROXIES_CONFIG.auth_enabled else "",
        indent=0,
        auth_api=AUTH_V1_LOCATION,
    )
Example #15
0
def get_favicon_config():
    return get_config(options=OPTIONS, indent=0)
Example #16
0
def get_archives_root_location_config():
    return get_config(
        options=ARCHIVES_LOCATION_OPTIONS,
        indent=0,
        archives_root=settings.PROXIES_CONFIG.archive_root.rstrip("/") + "/",
    )
Example #17
0
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)
Example #18
0
def get_logging_config():
    return get_config(options=OPTIONS,
                      indent=0,
                      level=settings.PROXIES_CONFIG.log_level)
Example #19
0
def get_timeout_config():
    return get_config(options=OPTIONS,
                      indent=0,
                      timeout=settings.PROXIES_CONFIG.nginx_timeout)
Example #20
0
def get_gzip_config():
    return get_config(options=OPTIONS, indent=0)
Example #21
0
def get_static_location_config():
    return get_config(options=STATIC_LOCATION_OPTIONS, indent=0)
Example #22
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)
Example #23
0
def get_tmp_location_config():
    return get_config(options=TMP_LOCATION_OPTIONS, indent=0)
Example #24
0
def get_ssl_config():
    return get_config(options=SSL_OPTIONS,
                      indent=0,
                      ssl_path=settings.PROXIES_CONFIG.ssl_path)
Example #25
0
def get_main_config(root=None):
    root = root or "/polyaxon"
    return get_config(options=OPTIONS, indent=0, root=root)
Example #26
0
def get_error_page_config():
    return get_config(options=OPTIONS, indent=0)
Example #27
0
def get_gunicorn_config():
    return get_config(options=UWSGI_OPTIONS, indent=0)
Example #28
0
def get_healthz_location_config():
    return get_config(
        options=HEALTHZ_LOCATION_OPTIONS,
        indent=0,
    )
Example #29
0
def get_buffering_config():
    return get_config(options=OPTIONS, indent=0)
Example #30
0
def get_charset_config():
    return get_config(options=OPTIONS, indent=0)