This commit is contained in:
124
packages/java/dev/kreuzberg/ServerConfig.java
generated
Normal file
124
packages/java/dev/kreuzberg/ServerConfig.java
generated
Normal file
@@ -0,0 +1,124 @@
|
||||
// This file is auto-generated by alef — DO NOT EDIT.
|
||||
// alef:hash:4e15143f4af1ae8bafbdb1506ef057da924484c66a19483966333558ad437e75
|
||||
// To regenerate: alef generate
|
||||
// To verify freshness: alef verify --exit-code
|
||||
// Issues & docs: https://github.com/kreuzberg-dev/alef
|
||||
package dev.kreuzberg;
|
||||
|
||||
import java.util.List;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* API server configuration.
|
||||
*
|
||||
* This struct holds all configuration options for the Kreuzberg API server,
|
||||
* including host/port settings, CORS configuration, and upload limits.
|
||||
*
|
||||
* # Defaults
|
||||
*
|
||||
* - {@code host}: "127.0.0.1" (localhost only)
|
||||
* - {@code port}: 8000
|
||||
* - {@code cors_origins}: empty vector (allows all origins)
|
||||
* - {@code max_request_body_bytes}: 104_857_600 (100 MB)
|
||||
* - {@code max_multipart_field_bytes}: 104_857_600 (100 MB)
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_ABSENT)
|
||||
@JsonDeserialize(builder = ServerConfig.Builder.class)
|
||||
public record ServerConfig(
|
||||
/**
|
||||
* Server host address (e.g., "127.0.0.1", "0.0.0.0")
|
||||
*/
|
||||
@Nullable @JsonProperty("host") String host,
|
||||
/**
|
||||
* Server port number
|
||||
*/
|
||||
@Nullable @JsonProperty("port") Short port,
|
||||
/**
|
||||
* CORS allowed origins. Empty vector means allow all origins.
|
||||
*
|
||||
* If this is an empty vector, the server will accept requests from any origin.
|
||||
* If populated with specific origins (e.g., {@code "https://example.com"}), only
|
||||
* those origins will be allowed.
|
||||
*/
|
||||
@Nullable @JsonProperty("cors_origins") List<String> corsOrigins,
|
||||
/**
|
||||
* Maximum size of request body in bytes (default: 100 MB)
|
||||
*/
|
||||
@Nullable @JsonProperty("max_request_body_bytes") Long maxRequestBodyBytes,
|
||||
/**
|
||||
* Maximum size of multipart fields in bytes (default: 100 MB)
|
||||
*/
|
||||
@Nullable @JsonProperty("max_multipart_field_bytes") Long maxMultipartFieldBytes
|
||||
) {
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
// CPD-OFF
|
||||
@JsonPOJOBuilder(withPrefix = "with", buildMethodName = "build")
|
||||
public static final class Builder {
|
||||
|
||||
private String host = null;
|
||||
private Short port = null;
|
||||
@JsonProperty("cors_origins")
|
||||
private List<String> corsOrigins = null;
|
||||
@JsonProperty("max_request_body_bytes")
|
||||
private Long maxRequestBodyBytes = null;
|
||||
@JsonProperty("max_multipart_field_bytes")
|
||||
private Long maxMultipartFieldBytes = null;
|
||||
|
||||
/** Sets the host field. */
|
||||
@JsonProperty("host")
|
||||
public Builder withHost(final @Nullable String value) {
|
||||
this.host = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets the port field. */
|
||||
@JsonProperty("port")
|
||||
public Builder withPort(final @Nullable Short value) {
|
||||
this.port = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets the corsOrigins field. */
|
||||
@JsonProperty("cors_origins")
|
||||
public Builder withCorsOrigins(final @Nullable List<String> value) {
|
||||
this.corsOrigins = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets the maxRequestBodyBytes field. */
|
||||
@JsonProperty("max_request_body_bytes")
|
||||
public Builder withMaxRequestBodyBytes(final @Nullable Long value) {
|
||||
this.maxRequestBodyBytes = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Sets the maxMultipartFieldBytes field. */
|
||||
@JsonProperty("max_multipart_field_bytes")
|
||||
public Builder withMaxMultipartFieldBytes(final @Nullable Long value) {
|
||||
this.maxMultipartFieldBytes = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Builds the ServerConfig instance. */
|
||||
public ServerConfig build() {
|
||||
return new ServerConfig(
|
||||
host,
|
||||
port,
|
||||
corsOrigins,
|
||||
maxRequestBodyBytes,
|
||||
maxMultipartFieldBytes
|
||||
);
|
||||
}
|
||||
}
|
||||
// CPD-ON
|
||||
public static ServerConfig defaultInstance() {
|
||||
throw new UnsupportedOperationException("defaultInstance is not yet bridged via JNI; use the Builder instead.");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user