Configuration
Jakon configuration is primarily managed through a standard Java .properties file. The framework uses reflection to map these properties to internal settings.
Configuration Loading
The ConfigurationInitializer is responsible for loading the configuration.
- Default File: By default, Jakon looks for
jakon_config.properties in the root directory of the application.
- Loading Mechanism:
- The framework reads the properties file into a map.
- It identifies classes annotated with
@Configuration (like Settings).
- For each field annotated with
@ConfigurationValue(name = "...", ...), it looks for a matching key in the properties map.
- If a property is missing:
- It uses the
defaultValue specified in the annotation if available.
- If no default is provided and
required = true, the application will throw an IllegalStateException and fail to start.
- Values are injected directly into fields or via setter methods if they follow the
setFieldName(String) convention.
Example jakon_config.properties
templateDir=templates/my_theme
staticDir=static
outputDir=out/
port=8080
hostname=localhost
databaseConnPath=jdbc:sqlite:my_database.sqlite
Configuration Options
Below is a detailed list of configuration options defined in Settings.scala.
General Configuration
Name |
Type |
Required |
Default Value |
Description |
|---|
templateDir |
String |
Yes |
templates/bacon |
Directory where template files are stored. |
staticDir |
String |
Yes |
static |
Directory for static assets (images, CSS, JS). |
outputDir |
String |
Yes |
out/ |
Directory where generated static files are placed. |
package |
String |
Yes |
- |
Semicolon-separated list of packages to scan for Jakon objects. |
deployMode |
Enum |
Yes |
DEVEL |
Deployment mode: DEVEL or PRODUCTION. |
deployType |
String |
Yes |
cz.kamenitxan.jakon.core.deploy.DummyDeploy |
Class name of the deployment handler. |
onlyRender |
Boolean |
Yes |
false |
If true, the application only renders templates without starting the server. |
Server Configuration
Name |
Type |
Required |
Default Value |
Description |
|---|
hostname |
String |
Yes |
- |
The hostname of the application. |
port |
Int |
Yes |
4567 |
The port on which the server listens. |
loginPath |
String |
Yes |
/login |
The path to the login page. |
initRoutes |
Boolean |
Yes |
true |
Whether to automatically initialize routes. |
Database Configuration
Jakon detects the database type (MYSQL or SQLITE) based on the connection string prefix.
Name |
Type |
Required |
Default Value |
Description |
|---|
databaseDriver |
String |
Yes |
org.sqlite.JDBC |
JDBC driver class name. |
databaseConnPath |
String |
Yes |
jdbc:sqlite:jakonTest.sqlite |
JDBC connection string. |
databaseUser |
String |
No |
"" |
Database username. |
databasePass |
String |
No |
"" |
Database password. |
Localization
Name |
Type |
Required |
Default Value |
Description |
|---|
defaultLocale |
Locale |
Yes |
en_US |
The default locale (e.g., en_US, cs_CZ). |
supportedLocales |
Seq[Locale] |
No |
en_US |
Comma-separated list of supported locales. |
Email Configuration (MAIL.)
Name |
Type |
Required |
Default Value |
Description |
|---|
MAIL.enabled |
Boolean |
Yes |
true |
Enable or disable email functionality. |
MAIL.host |
String |
No |
- |
SMTP server host. |
MAIL.port |
String |
No |
25 |
SMTP server port. |
MAIL.username |
String |
No |
- |
Username for SMTP authentication. |
MAIL.password |
String |
No |
- |
Password for SMTP authentication. |
MAIL.auth |
String |
No |
- |
SMTP authentication method. |
MAIL.tls |
Boolean |
No |
false |
Enable STARTTLS. |
MAIL.ssl |
Boolean |
No |
false |
Enable SSL. |
MAIL.force_bcc |
String |
No |
- |
BCC address for all outgoing mail. |
emailValidator.checkDns |
Boolean |
No |
true |
Check DNS record when validating email addresses. |
Security and Integrations
Name |
Type |
Required |
Default Value |
Description |
|---|
encryptionSecret |
String |
Yes |
reallyRandomStin |
Secret key used for internal encryption. |
HCAPTCHA.siteKey |
String |
No |
- |
hCaptcha Site Key. |
HCAPTCHA.secret |
String |
No |
- |
hCaptcha Secret Key. |