Package io.floci.testcontainers.config
Class TlsConfig
java.lang.Object
io.floci.testcontainers.config.TlsConfig
Optional TLS configuration for enabling HTTPS on the Floci server.
When enabled, all endpoints are reachable via
https:// and
WebSocket connections work via wss://.
Both HTTP and HTTPS are served simultaneously (LocalStack parity).
Instances are created via TlsConfig.Builder:
TlsConfig config = TlsConfig.builder()
.enabled(true)
.selfSigned(true)
.build();
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyEnvVarsToContainer(org.testcontainers.containers.Container<?> container) Applies this TLS configuration to the given container by setting the appropriate environment variables.static TlsConfig.Builderbuilder()Returns a newTlsConfig.Builderfor this configuration.intReturns the additional port the TLS proxy binds for AWS-style HTTPS traffic, alongside the public Floci port.Returns the path to the PEM certificate file, or empty if not set.Returns the path to the PEM private key file, or empty if not set.booleanReturns whether TLS/HTTPS is enabled on the server.booleanReturns whether a self-signed certificate should be auto-generated when nocertPath/keyPathis provided.Returns a newTlsConfig.Builderfor this configuration, initialized with the current values of this instance.
-
Method Details
-
builder
Returns a newTlsConfig.Builderfor this configuration.- Returns:
- a new builder
-
toBuilder
Returns a newTlsConfig.Builderfor this configuration, initialized with the current values of this instance.- Returns:
- a new builder pre-populated with this configuration's values
-
isEnabled
public boolean isEnabled()Returns whether TLS/HTTPS is enabled on the server.- Returns:
trueif TLS is enabled
-
getCertPath
Returns the path to the PEM certificate file, or empty if not set.- Returns:
- the certificate path, or empty
-
getKeyPath
Returns the path to the PEM private key file, or empty if not set.- Returns:
- the private key path, or empty
-
isSelfSigned
public boolean isSelfSigned()Returns whether a self-signed certificate should be auto-generated when nocertPath/keyPathis provided.- Returns:
trueif self-signed certificate generation is enabled
-
getAwsHttpsPort
public int getAwsHttpsPort()Returns the additional port the TLS proxy binds for AWS-style HTTPS traffic, alongside the public Floci port.CDK/CloudFormation custom resources send their
cfn-responsecallback with bundled code that hardcodeshttps://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.Default 443. Set to
0to 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.- Returns:
- the additional AWS-style HTTPS port
-
applyEnvVarsToContainer
public void applyEnvVarsToContainer(org.testcontainers.containers.Container<?> container) Applies this TLS configuration to the given container by setting the appropriate environment variables.- Parameters:
container- the container to configure
-