Class TlsConfig.Builder

java.lang.Object
io.floci.testcontainers.config.TlsConfig.Builder
Enclosing class:
TlsConfig

public static class TlsConfig.Builder extends Object
Builder for TlsConfig.
  • Method Details

    • enabled

      public TlsConfig.Builder enabled(boolean enabled)
      Enables or disables TLS/HTTPS on the server.
      Parameters:
      enabled - true to enable (default false)
      Returns:
      this builder
    • certPath

      public TlsConfig.Builder certPath(String certPath)
      Sets the path to the PEM certificate file. When set together with keyPath(String), the provided certificate is used instead of a generated one.
      Parameters:
      certPath - the path to the PEM certificate file, or null to unset
      Returns:
      this builder
    • keyPath

      public TlsConfig.Builder keyPath(String keyPath)
      Sets the path to the PEM private key file. When set together with certPath(String), the provided key is used instead of a generated one.
      Parameters:
      keyPath - the path to the PEM private key file, or null to unset
      Returns:
      this builder
    • selfSigned

      public TlsConfig.Builder selfSigned(boolean selfSigned)
      Sets whether a self-signed certificate should be auto-generated when no certPath/keyPath is provided. The generated files are persisted to {storage.persistent-path}/tls/ and reused across restarts.
      Parameters:
      selfSigned - true to auto-generate a self-signed certificate (default true)
      Returns:
      this builder
    • awsHttpsPort

      public TlsConfig.Builder awsHttpsPort(int awsHttpsPort)
      Sets the additional port the TLS proxy binds for AWS-style HTTPS traffic, alongside the public Floci port.

      CDK/CloudFormation custom resources send their cfn-response callback with bundled code that hardcodes https:// and ignores the port in the ResponseURL, so the PUT lands on the conventional 443 regardless of Floci's configured port. Binding 443 here (with the same HTTP/HTTPS protocol detection used on the main port) lets those callbacks — and any other client that assumes AWS lives on 443 — reach Floci.

      Set to 0 to disable the extra binding (e.g. when Floci runs unprivileged or another process owns 443). When equal to the main Floci port only a single listener is started.

      Parameters:
      awsHttpsPort - the additional AWS-style HTTPS port (default 443)
      Returns:
      this builder
    • build

      public TlsConfig build()
      Creates an immutable TlsConfig from this builder.
      Returns:
      the TLS configuration