Module config

Source
Expand description

The config module provides functionality for loading and configuring TLS settings for the API server.

This module simplifies the process of setting up secure HTTPS communication by reading certificate and private key files and creating a ServerConfig object compatible with Rustls and Actix Web. This module is used internally by the Api struct.

This module features:

  • Certificate Loading: Reads and parses PEM-encoded certificate chains.
  • Private Key Loading: Reads and parses PEM-encoded private keys.
  • Rustls Integration: Creates a ServerConfig for secure HTTPS communication.

§Example

use rusty_api::Api;

let api = Api::new()
   .certs("path/to/cert.pem", "path/to/key.pem") // Load the certificate and key into the API struct
   .start(); // Starting the API server will call this module internally.

Functions§

load_rustls_config
Loads the TLS configuration for the API server.