{ "$schema": "http://json-schema.org/draft-07/schema#", "title": "Kobweb conf.yaml", "description": "Configuration for a Kobweb project, especially its server behavior.", "type": "object", "additionalProperties": false, "required": ["site", "server"], "properties": { "site": { "description": "Properties that affect how the site is presented to the user.", "type": "object", "additionalProperties": false, "required": ["title"], "properties": { "title": { "description": "The title of the site, used as the page's .", "type": "string" }, "basePath": { "description": "A subfolder that all site content lives under. For example, with \"/a/b/c\", the root index.html is served at `mysite.com/a/b/c/`. Rarely needed, but some server configurations nest sites in a subdirectory.", "type": "string", "default": "" } } }, "server": { "description": "Configuration for the Kobweb server.", "type": "object", "additionalProperties": false, "required": ["files"], "properties": { "files": { "description": "Files and paths the Kobweb server needs to serve the site.", "type": "object", "additionalProperties": false, "required": ["dev", "prod"], "properties": { "dev": { "description": "Files used by the dev server, which serves a single html file representing the whole project.", "type": "object", "additionalProperties": false, "required": ["contentRoot", "script"], "properties": { "contentRoot": { "description": "The path to serve content from, which includes the Kobweb index.html file.", "type": "string" }, "script": { "description": "The path to the JavaScript file generated from the site's Kotlin code.", "type": "string" }, "api": { "description": "The path to the API jar generated by the project, if any. Used to extend the behavior of the Kobweb server.", "type": ["string", "null"], "default": null } } }, "prod": { "description": "Files used by the production server.", "type": "object", "additionalProperties": false, "required": ["script"], "properties": { "script": { "description": "The path to the minimized JavaScript file generated from the site's Kotlin code.", "type": "string" }, "siteRoot": { "description": "The path to the root of the exported static site.", "type": "string", "default": ".kobweb/site" } } } } }, "port": { "description": "The port the server listens on. In dev mode, if the port is in use, the next free one is used instead.", "type": "integer", "minimum": 1, "maximum": 65535, "default": 8080 }, "logging": { "description": "Configuration for logging. By default, logs append to a single file which rolls over at the end of each day.", "type": "object", "additionalProperties": false, "properties": { "level": { "description": "The minimum level of log messages to show. DEBUG is a good balance of verbosity and usefulness. TRACE is very verbose, and mostly useful for debugging tricky issues locally (e.g. CORS misconfigurations or unexpected 403s).", "enum": ["ALL", "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "OFF"], "default": "DEBUG" }, "enableConsoleLogging": { "description": "If true, logs are written to stdout/stderr.", "type": "boolean", "default": true }, "enableFileLogging": { "description": "If true, logs are also written to a file. If false, the other file-related logging properties are ignored.", "type": "boolean", "default": true }, "interceptSystemOutput": { "description": "If true, `println` / `System.out.println` and `System.err.println` calls are rerouted to the info and warn log streams, respectively.", "type": "boolean", "default": true }, "logRoot": { "description": "The directory where logs are stored. If it will contain files other than logs, consider setting `clearLogsOnStart` to false.", "type": "string", "default": ".kobweb/server/logs" }, "clearLogsOnStart": { "description": "If true, all files under `logRoot` are deleted when a dev server starts. Be careful if `logRoot` contains non-log files!", "type": "boolean", "default": true }, "logFileBaseName": { "description": "The base name of the log file. A suffix is added automatically, and archived logs reuse the base name.", "type": "string", "default": "kobweb-server" }, "maxFileCount": { "description": "The maximum number of log files to keep before old ones are deleted. Null (or 0) means unbounded.", "type": ["integer", "null"], "minimum": 0, "default": null }, "totalSizeCap": { "description": "The maximum total size of all log files before old ones are deleted, as a number followed by a unit (B, K, M, G, KB, MB, GB, KiB, MiB or GiB, case-insensitive). Null (or \"0B\") means unbounded.", "type": ["string", "null"], "pattern": "^[0-9]+([BbKkMmGg]|[KkMmGg][Bb]|[KkMmGg][Ii][Bb])$", "examples": ["10MiB", "500MB", "1GiB"], "default": "10MiB" }, "compressHistory": { "description": "If true, log files are compressed when they roll over.", "type": "boolean", "default": true } } }, "cors": { "description": "Configuration for CORS. See also: https://ktor.io/docs/cors.html", "type": "object", "additionalProperties": false, "properties": { "hosts": { "description": "Hosts allowed to make cross-origin requests to this site.", "type": "array", "default": [], "items": { "type": "object", "additionalProperties": false, "required": ["name"], "properties": { "name": { "description": "The hostname (and optional port), e.g. \"somesite.com:1234\". Don't include the scheme; use `schemes` for that. \"*\" allows any host, which should be avoided in production.", "type": "string" }, "schemes": { "description": "The HTTP schemes allowed for this host, e.g. \"http\". Must not be empty unless `name` is \"*\".", "type": "array", "items": { "type": "string" }, "default": ["http", "https"] }, "subdomains": { "description": "Subdomains to allow, e.g. \"media\" to allow \"media.varabyte.com\".", "type": "array", "items": { "type": "string" }, "default": [] } }, "if": { "not": { "properties": { "name": { "const": "*" } } } }, "then": { "properties": { "schemes": { "minItems": 1 } } } } } } }, "redirects": { "description": "URL redirects. Visiting a `from` path makes the server issue a 301 redirect to the `to` path.", "type": "array", "default": [], "items": { "type": "object", "additionalProperties": false, "required": ["from", "to"], "properties": { "from": { "description": "A regex matching the path to redirect, e.g. \"/old/([^/]*)\". It must start with a leading slash, or it will never match.", "type": "string" }, "to": { "description": "The path to redirect to. Capture groups from `from` can be substituted using `$1`, `$2`, etc., e.g. \"/new/$1\".", "type": "string" } } } }, "streaming": { "description": "Configuration for streaming APIs, which are built on WebSockets. See also: https://ktor.io/docs/websocket.html", "type": "object", "additionalProperties": false, "properties": { "pingPeriod": { "description": "The duration between pings, or \"0s\" to disable pings. Uses Kotlin duration syntax (e.g. \"15s\", \"1m 30s\") or ISO-8601 (e.g. \"PT15S\").", "type": "string", "examples": ["0s", "15s", "1m 30s"], "default": "0s" }, "timeout": { "description": "The write/ping timeout after which a connection is closed. Uses Kotlin duration syntax (e.g. \"15s\", \"1m 30s\") or ISO-8601 (e.g. \"PT15S\").", "type": "string", "examples": ["15s", "1m 30s"], "default": "15s" } } }, "nativeLibraries": { "description": "Explicit name-to-path mappings for native libraries loaded by API routes. Rarely needed; Kobweb usually finds the right file on its own.", "type": "array", "default": [], "items": { "type": "object", "additionalProperties": false, "required": ["name", "path"], "properties": { "name": { "description": "The generic library name the JVM requests, e.g. \"test\".", "type": "string" }, "path": { "description": "The path to the library file to load, e.g. \"jni/linux/libtest.so\".", "type": "string" } } } } } } } }