Skip to main content

Configuration Reference

Snippets show default values where a property has one.

Environment Variables​

Properties that have an environment variable specified will override the respective property in konifer.conf.

The order of configuration precedence is:

  1. Environment variable (for available properties)
  2. Property in konifer.conf
  3. Default value (if specified)

Datastore​

Properties for configuring the datastore.

data-store {
provider = postgresql
postgresql {
database = konifer
host = localhost
port = 5432
user = postgres
password = ""
}
}
PropertyDescriptionAllowed InputDefaultEnvironment variable
data-store.providerThe implementation of your data storein-memory, postgresqlpostgresqlIN_MEMORY*
data-store.postgresql.databaseDatabase to use within the RDBMSStringkonifer
data-store.postgresql.hostPostgresql hostStringlocalhost
data-store.postgresql.portPostgresql portInteger5432
data-store.postgresql.userPostgresql userStringpostgresPG_USER
data-store.postgresql.passwordPostgresql passwordString""PG_PASSWORD
data-store.postgresql.ssl-modePostgresql SSL ModeStringprefer

If IN_MEMORY=true is set as an environment variable, both the data store and object store providers will be set to in-memory.

HTTP​

http {
# Optional
public-url = "https://images.example.com"
}
PropertyDescriptionAllowed InputDefault
http.public-urlBase URL for service delivery URLs and absolute asset Location headers. See the behavior below.Any URL beginning with http:// or https://None

When http.public-url is omitted, Konifer uses the scheme, host, and port of the incoming request. This keeps local setup working without additional configuration. Set it when Konifer must generate URLs for a different public origin, such as when TLS terminates at a reverse proxy. Konifer does not interpret forwarded headers to determine this value.

API​

Properties for enabling optional API endpoints.

api {
rule-evaluation {
enabled = false
}
}
PropertyDescriptionAllowed InputDefault
api.rule-evaluation.enabledEnables POST /rule-evaluations for testing rule definitions against images.Booleanfalse

When disabled, the rule evaluation route is not registered and returns 404 Not Found. Enabling it initializes SigLIP2 rule inference even when rule-definitions is empty, so the model files must be installed. See Rule Evaluation for setup and operational guidance.

Object Store​

Properties for configuring the datastore.

object-store {
provider = filesystem
s3 { # No defaults - overrides Default Provider Chain if supplied
access-key = "[no default]"
endpoint-url = "[no default]"
region = "[no default]"
secret-key = "[no default]"
}
filesystem {
mount-path = "[no default]"
}
}
PropertyDescriptionAllowed InputDefaultEnvironment variable
object-store.providerThe implementation of your object storein-memory, s3, filesystemfilesystemIN_MEMORY*
object-store.s3.access-keyThe access key of your S3 (or S3-compatible) object storeStringNone
object-store.s3.endpoint-urlThe endpoint URL of your S3 (or S3-compatible) object storeStringNone
object-store.s3.regionThe region of your object storeStringNone
object-store.s3.secret-keyThe secret key of your object storeStringNoneS3_SECRET_KEY
object-store.s3.force-path-styleCommunicate with S3 API using path-style or virtual-host styleBooleanfalse
object-store.filesystem.mount-pathThe path that your filesystem is mounted to within your containerValid Linux path (ex: /mnt/store)None

If IN_MEMORY=true is set as an environment variable, both the data store and object store providers will be set to in-memory.

Source​

source {
url {
allowed-domains = []
max-bytes = 20MB
}
multipart {
max-bytes = 20MB
}
}
PropertyDescriptionAllowed InputDefault
source.url.allowed-domainsDomains Konifer may access for asset storage and rule evaluation from a URL source.Any valid domain[]
source.url.max-bytesMaximum asset or rule evaluation image size downloaded from a URL .Positive byte size (see below)20MB
source.multipart.max-bytesMaximum asset or rule evaluation image size supplied as multipart content.Positive byte size (see below)20MB

Byte sizes can be exact byte counts, such as 20000000, or strings with a case-insensitive unit. Decimal units are B, KB, MB, and GB; binary units are KiB, MiB, and GiB. The numeric part must be a positive integer. For example, 20MB is 20,000,000 bytes, while 20MiB is 20,971,520 bytes.

Variant Profiles​

variant-profiles {
# Empty by default
"profile-name" {
}
}
PropertyDescriptionAllowed InputDefault
variant-profilesMap of defined variant profiles that can be used for eager variants and on-demand variants. Keyed by the profile name.Variant profile object{}

All image transformation parameters can be used within a variant profile object.

Rule Definitions​

Rule definitions are global zero-shot image classification rules that can be referenced by path-level upload rulesets. They are empty by default.

rule-definitions {
"rule-name" {
prompts = [
"a visual description of the content to detect"
]
threshold = 0.70
}
}
PropertyDescriptionAllowed InputDefault
rule-definitionsMap of named rule definitions. The rule name is referenced from path-level upload rulesets.Rule definition object{}
rule-definitions.<name>.promptsText prompts used for zero-shot matching. The highest scoring prompt determines the rule result.1-100 stringsNone
rule-definitions.<name>.thresholdMinimum model score required for the rule to match.Decimal from 0.0-1.0None

Rule names cannot be blank and cannot be longer than 32 characters. Use lowercase rule definition keys because upload rule references are normalized to lowercase.

SigLIP2 model files are required when rule-definitions is populated or the Rule Evaluation API is enabled. See Upload Rules for model installation and mount instructions.

Variant Generation​

variant-generation {
queue-size = 1000
synchronous-priority = 80
workers = [number of available CPU cores]
}
PropertyDescriptionAllowed InputDefault
variant-generation.queue-sizeAmount of variant generation requests that can be queued up awaiting processing. Requests over this limit suspend the request.Positive integer1000
variant-generation.synchronous-priorityPercentage priority to give to synchronous variant generation tasks. The remaining priority is reversed for async tasks.1-9980
variant-generation.workersAmount of concurrent image processor workersPositive integer# of available CPU cores

URL Signing​

url-signing {
enabled = false
algorithm = hmac_sha256
secret-key = "[no default]"
}
PropertyDescriptionAllowed InputDefaultEnvironment variable
url-signing.enabledEnable url-signing for GET requests or notBooleanfalse
url-signing.algorithmHMAC signing algorithm that signatures usehmac_sha256, hmac_sha384, hmac_sha512hmac_sha256
url-signing.secret-keyHMAC secret key used for validating signaturesStringNoneURL_SIGNING_SECRET_KEY

Path Configuration Reference​

By default, nothing is configured within paths. If nothing is configured, the default configuration below is used.

paths {
# Match everything greedily after /
"/**" {
lqip = []
limits {
max-width = 8192
max-height = 8192
max-pixels = 20MP
max-pages = 20
max-pixels-per-page = 1MP
}
transform {
limits {
max-width = 8192
max-height = 8192
max-pixels = 20MP
}
preprocessing {
enabled = false
# Preprocessing disabled by default
# Populate with URL manipulation parameters i.e. w = 100, h = 200, r = 90, etc.
}
eager-variants = []
on-demand-variant {
mode = enabled
}
expire {
strategy = never
ttl = [no default]
}
}
object-store {
bucket = assets
}
upload-ruleset {
default = accept
accept-rules = []
reject-rules = []
modify-rules = []
}
delivery {
strategy = service
template {
string = "http://localhost"
}
presigned {
ttl = 30m
}
}
cache-control {
enabled = false
max-age = "[no default]"
s-maxage = "[no default]"
visibility = "[no default]"
revalidate = "[no default]"
stale-while-revalidate = "[no default]"
stale-if-error = "[no default]"
immutable = false
}
}
}

LQIP​

"/**" {
lqip = []
}
PropertyDescriptionAllowed InputDefault
lqipLQIP algorithms enabledblurhash, thumbhash[]

Allowed Content Types​

"/**" {
allowed-content-types = [ "image/png", "image/jpeg" ]
}
PropertyDescriptionAllowed InputDefault
allowed-content-typesContent types allowed for uploads to the path. Omit to allow all supported image formats.Supported image MIME type listNone

Supplied Asset Content Limits​

Supplied asset content limits constrain the image received from a multipart upload or URL source. Konifer checks these limits before preprocessing and does not store content that exceeds them.

"/**" {
limits {
max-width = 8192
max-height = 8192
max-pixels = 20MP
max-pages = 20
max-pixels-per-page = 1MP
}
}
PropertyDescriptionAllowed InputDefault
limits.max-widthMaximum width of supplied content in pixelsPositive integer8192
limits.max-heightMaximum height of supplied content in pixelsPositive integer8192
limits.max-pixelsMaximum width multiplied by height for single-page contentPositive pixel count (below)20MP
limits.max-pagesMaximum page or frame count for multi-page contentPositive integer20
limits.max-pixels-per-pageMaximum width multiplied by height for each page or framePositive pixel count (below)1MP

For single-page content, Konifer applies max-pixels and ignores max-pixels-per-page. For multi-page content, it applies max-pixels-per-page and max-pages instead of max-pixels. Width and height limits apply to both.

Pixel counts can be exact counts, such as 20000000, or strings with the case-insensitive units P, KP, MP, and GP. These use decimal multipliers. Decimals are accepted when they resolve to a whole number of pixels; for example, 8.2944MP is 8,294,400 pixels. This format is also accepted by transform.limits.max-pixels.

See Storing Assets for usage guidance.

Transform​

Transformation Limits​

Transformation limits constrain the final output dimensions of preprocessing, eager variants, and on-demand variants. They do not constrain an original variant that is stored without preprocessing.

"/**" {
transform {
limits {
max-width = 8192
max-height = 8192
max-pixels = 20MP
}
}
}
PropertyDescriptionAllowed InputDefault
transform.limits.max-widthMaximum final output width in pixelsPositive integer8192
transform.limits.max-heightMaximum final output height in pixelsPositive integer8192
transform.limits.max-pixelsMaximum final output width multiplied by heightPositive pixel count20MP

Final dimensions include padding and reflect rotation. Konifer validates configured preprocessing and eager variants when their output dimensions are known. If a missing dimension or automatic rotation depends on the source image, the remaining limits are enforced after the transformation is normalized at runtime.

See Supplied Asset Content Limits for accepted pixel-count formats. Supplied content limits and transformation limits are independent: the former validate input, while the latter validate generated output.

See Transformation Limits for behavior and examples.

Preprocessing​

"/**" {
transform {
preprocessing {
enabled = false
# Preprocessing disabled by default
}
}
}
PropertyDescriptionAllowed InputDefault
transform.preprocessing.enabledEnable preprocessingBooleanfalse

All image transformation parameters can be used directly within the preprocessing block, as well as:

PropertyDescriptionAllowed InputDefault
transform.preprocessing.clamp-heightMaximum heightIntegerNone
transform.preprocessing.clamp-widthMaximum widthIntegerNone
note

h and w take precedence over clamp-height and clamp-width respectively, if both are specified.

Eager Variants​

"/**" {
transform {
eager-variants = []
}
}
PropertyDescriptionAllowed InputDefault
transform.eager-variantsList of variant profiles to generate eager variants fromprofiles names from variant-profiles arrayNone

On-demand Variant​

"/**" {
transform {
on-demand-variant {
mode = enabled
}
}
}
PropertyDescriptionAllowed InputDefault
transform.on-demand-variant.modeOn-demand variant generation modeenabled, profile_only, disabledenabled

Expiration​

"/**" {
transform {
expire {
strategy = never
ttl = [no default]
}
}
}
PropertyDescriptionAllowed InputDefault
transform.expire.strategyThe variant expiry strategy to usenever, ttl, idlenever
transform.expire.ttlThe time-to-live (in Duration format) used in idle or ttl strategies. Ignored when strategy is never.Duration e.g. 24h, 7d, 10mNo default
Duration​

A duration is represented similarly to how Spring accepts a Duration property value. The time unit is appended to the amount.

Units can be:

  • s for seconds
  • m for minutes
  • h for hours
  • d for days
note

Due to how expired variants are purged, expiration may be delayed by up to 1 minute after the configured TTL.

Object Store​

"/**" {
object-store {
bucket = assets
}
}
PropertyDescriptionAllowed InputDefault
object-store.bucketBucket to persist assets and variants in. This can be safely changed without de-referencing existing assets, however, existing assets are not moved to new bucket.Valid bucket nameassets

Upload Ruleset​

"/**" {
upload-ruleset {
default = accept
accept-rules = []
reject-rules = []
modify-rules = []
}
}
PropertyDescriptionAllowed InputDefault
upload-ruleset.defaultDecision to use when no configured accept or reject rule matches.accept, rejectaccept
upload-ruleset.accept-rulesRules that accept an upload when matched. Usually used with default = reject.List of upload rule objects[]
upload-ruleset.reject-rulesRules that reject an upload when matched. Usually used with default = accept.List of upload rule objects[]
upload-ruleset.modify-rulesRules that modify the asset when matched. These rules do not change the upload decision.List of upload rule objects[]
upload-ruleset.modify-rules[].labelsLabels added to the stored asset when the rule matches. Rule labels override request labels that use the same key.Map of label keys and values{}
upload-ruleset.*-rules[].ruleName of a top-level rule definition to evaluate.Configured rule nameNone
upload-ruleset.*-rules[].violation-responseOptional response message returned when a reject rule rejects an upload. Ignored for non-reject rules.String shorter than 200 charsNone

The same rule cannot appear in both accept-rules and reject-rules within a single upload ruleset.

Each label key must be non-blank and no longer than 128 characters. Each value must be non-blank and no longer than 256 characters. An asset can have at most 50 labels after labels from the upload request and matched label rules are merged.

Upload rulesets are path configuration, so a child path can override an inherited ruleset. See Upload Rules for examples and prompt ensemble guidance.

Delivery​

"/**" {
delivery {
strategy = service
template {
string = "http://localhost"
}
presigned {
ttl = 30m
}
}
}

The selected strategy resolves the URL returned by link and used as the Location header by redirect.

PropertyDescriptionAllowed InputDefault
delivery.strategyHow Konifer resolves delivery URLsservice, presigned, templateservice
delivery.template.stringURL for template; supports {bucket} and {key}URL stringhttp://localhost
delivery.presigned.ttlTime-to-live for URLs generated by the presigned strategyPositive duration up to 7 days (7d)30m (30 minutes)

The service strategy resolves to the selected entry's /content endpoint. presigned asks the configured object store for a temporary URL and falls back to the service URL when the provider cannot generate one. template substitutes the selected variant's stored bucket and key into the configured string.

Cache Control​

"/**" {
cache-control {
enabled = false
max-age = "[no default]"
s-maxage = "[no default]"
visibility = "[no default]"
revalidate = "[no default]"
stale-while-revalidate = "[no default]"
stale-if-error = "[no default]"
immutable = false
}
}
PropertyDescriptionAllowed InputDefault
enabledWhether the Cache-Control header should be returnedBooleanfalse
max-ageSet the max-age descriptorInteger > 0
s-maxageSet the max-age descriptorInteger > 0
visibilitySet the visibility of the cached assetpublic, private
revalidateCache control revalidationmust-revalidate, proxy-revalidate, no-cache
stale-while-revalidateSet the stale-while-revalidate descriptorInteger > 0
stale-if-errorSet the stale-if-error descriptorInteger > 0
immutableWhether to set the immutable descriptorBooleanfalse