KScript docs
EN

App folders: KScript.Storage

The person's own settings

$config holds the project's settings, from the config section of kscript.json (see Settings). With "user_config": true in the app section, it also reads config.json from the app's config folder, after the project's own settings:

JSON
// kscript.json
{
  "app": { "name": "Notes", "user_config": true },
  "config": { "greeting": "Hello" }
}

A person can then change a setting for themselves without editing the project, and a script can save one for them:

<import package="KScript.Storage" />

<echo value="$config.greeting" />
<do>@storage(config)->write_json('config.json', { greeting: 'Hi there' })</do>
<echo value="$config->reload().greeting" />
import KScript.Storage

echo $config.greeting
@storage(config)->write_json('config.json', { greeting: 'Hi there' })
echo $config->reload().greeting

The config statement does the same for one script: config(user: true).