Skip to main content

start_server

Function start_server 

Source
pub fn start_server(
    py: Python<'_>,
    run_args: &ProxyServerConfig,
) -> PyResult<()>
Expand description

Start an HTTP + HTTPS reverse‑proxy for IBM COS.

Equivalent to running pingora with a custom handler.

§Parameters

run_args: A :py:class:ProxyServerConfig object containing the configuration for the server. The configuration includes the following parameters:

  • cos_map: A dictionary mapping bucket names to their respective COS configuration. Each entry should contain the following keys:
    • host: The COS endpoint (e.g., “s3.eu-de.cloud-object-storage.appdomain.cloud”)
    • port: The port number (e.g., 443)
    • api_key/apikey: The API key for the bucket (optional)
    • ttl/time-to-live: The time-to-live for the API key in seconds (optional)
  • bucket_creds_fetcher: Optional Python async callable that fetches the API key for a bucket. The callable should accept a single argument, the bucket name. It should return a string containing the API key.
  • http_port: The HTTP port to listen on.
  • https_port: The HTTPS port to listen on.
  • validator: Optional Python async callable that validates the request. The callable should accept two arguments, the access_key and the bucket name. It should return a boolean indicating whether the request is valid.
  • threads: Optional number of threads to use for the server. If not specified, the server will use a single thread.