Skip to main content

Configuration Reference

Values used in snippets are the default properties.

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 {
public-url = "http://localhost"
}
PropertyDescriptionAllowed InputDefault
http.public-urlThe URL used to resolve content selector links. This is the root public URL of your website/platform/API.Any URL beginning with http:// or https://http://localhost

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 = 104857600 # 100MB
}
multipart {
max-bytes = 104857600 # 100MB
}
}
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 integer representing bytes104857600
source.multipart.max-bytesMaximum asset or rule evaluation image size supplied as multipart content.Positive integer representing bytes104857600

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 /
"/**" {
image {
lqip = []
}
transform {
preprocessing {
enabled = false
image {
# 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 = []
}
return-format {
redirect {
strategy = none
template {
string = 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
}
}
}

Image

"/**" {
image {
lqip = []
}
}
PropertyDescriptionAllowed InputDefault
image.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

Transform

Preprocessing

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

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

PropertyDescriptionAllowed InputDefault
transform.preprocessing.image.max-heightMaximum heightIntegerNone
transform.preprocessing.image.max-widthMaximum widthIntegerNone
note

h and w take precedence over max-height and max-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.

Return Format

"/**" {
return-format {
redirect {
strategy = none
template {
string = localhost
}
presigned {
ttl = 30m
}
}
}
}
PropertyDescriptionAllowed InputDefault
return-format.redirect.strategyHow to serve redirect URLsnone, presigned, templatenone
return-format.redirect.template.stringTemplate string to use if strategy is templateValid URL stringlocalhost
return-format.redirect.presigned.ttlTime-to-live for presigned redirect URLs if strategy is presignedDuration-style format. Up to 7 days (7d)30m (30 minutes)

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