Beispiel #1
0
def get_base_config():
    resolver = get_resolver()
    auth = get_auth_config()
    config = [get_listen_config(is_proxy=True)]
    if settings.PROXIES_CONFIG.ssl_enabled:
        config.append(get_ssl_config())
    config += [
        get_logging_config(),
        get_gzip_config(),
        get_charset_config(),
        get_buffering_config(),
        get_timeout_config(),
        get_error_page_config(),
        get_robots_config(),
        get_favicon_config(),
        get_healthz_location_config(),
        get_auth_location_config(resolver=resolver),
        get_streams_location_config(resolver=resolver, auth=auth),
        get_services_location_config(resolver=resolver, auth=auth, rewrite=False),
        get_services_location_config(resolver=resolver, auth=auth, rewrite=True),
        get_api_location_config(resolver=resolver, auth=auth),
    ]
    # config += get_plugins_location_config(resolver=resolver, auth=auth)

    return clean_config(config)
Beispiel #2
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 = ""
    ssl_server_name = get_ssl_server_name(service)
    header_host = get_header_host(service)
    config = [
        get_api_config(
            path="= /",
            service=service,
            resolver=resolver,
            auth=auth,
            ssl_server_name=ssl_server_name,
            header_host=header_host,
        ),
        get_api_config(
            path=API_V1_LOCATION,
            service=service,
            resolver=resolver,
            auth=auth,
            ssl_server_name=ssl_server_name,
            header_host=header_host,
        ),
        get_api_config(
            path=UI_V1_LOCATION,
            service=service,
            resolver=resolver,
            auth="",
            ssl_server_name=ssl_server_name,
            header_host=header_host,
        ),
        get_api_config(
            path="/static/",
            service=service,
            resolver=resolver,
            auth="",
            ssl_server_name=ssl_server_name,
            header_host=header_host,
        ),
    ]
    if settings.PROXIES_CONFIG.ui_admin_enabled:
        config.append(
            get_api_config(
                path=ADMIN_V1_LOCATION,
                service=service,
                resolver=resolver,
                auth=auth,
                ssl_server_name=ssl_server_name,
                header_host=header_host,
            )
        )
    return clean_config(config)
Beispiel #3
0
def get_uwsgi_config():
    config = [
        get_api_config(path="= /"),
        get_api_config(path="= {}".format(HEALTHZ_LOCATION)),
        get_api_config(path=API_V1_LOCATION),
        get_api_config(path=AUTH_V1_LOCATION),
        get_api_config(path=UI_V1_LOCATION),
    ]
    if settings.PROXIES_CONFIG.ui_admin_enabled:
        config.append(get_api_config(path=ADMIN_V1_LOCATION))
    return clean_config(config)
Beispiel #4
0
def get_base_config():
    config = [get_listen_config(is_proxy=False, port=settings.PROXIES_CONFIG.api_port)]
    config += [
        get_logging_config(),
        get_gzip_config(),
        get_charset_config(),
        get_buffering_config(),
        get_timeout_config(),
        get_uwsgi_config(),
        get_error_page_config(),
        get_robots_config(),
        get_favicon_config(),
        get_api_locations_config(),
    ]

    return clean_config(config)
Beispiel #5
0
def get_base_config():
    config = [
        get_listen_config(is_proxy=False,
                          port=settings.PROXIES_CONFIG.streams_port)
    ]
    config += [
        get_logging_config(),
        get_gzip_config(),
        get_charset_config(),
        get_buffering_config(),
        get_timeout_config(),
        get_gunicorn_config(),
        get_error_page_config(),
        get_streams_locations_config(),
    ]

    return clean_config(config)