Skip to content

Use paths, MP_HOME tokens and environment variables in apps

Token Expands to
{MP_HOME} Portable: the folder holding moonpool.exe (the .moonpool\ folder). Installed on Windows: %USERPROFILE%\.moonpool. Linux: $XDG_CONFIG_HOME/Moonpool, else ~/.config/Moonpool, the same folder as {MP_DATA}.
{MP_DATA} The config folder, the one that holds apps.json.

A token that cannot be resolved is left as written.

Field Tokens Leading ./ or .\
cwd yes yes, anchored to {MP_HOME}
command yes no
stopCommand yes no (it runs in cwd, which is anchored)
url yes no
icon yes yes, anchored to {MP_HOME}
env values, processName, note no no

A relative path without ./ (such as apps\tool) is left alone and resolves against Moonpool’s own working folder, which is rarely what you want. Prefer ./ or a token.

./apps/notes anchored to {MP_HOME}
{MP_HOME}\apps\notes\notes.exe token
{MP_DATA}\dumps token
apps\tool left alone, resolves against Moonpool's working folder
apps.json
{ "id": "notes", "name": "Notes", "group": "Desktop apps", "type": "desktop",
"cwd": "./apps/notes",
"command": "{MP_HOME}\\apps\\notes\\notes.exe",
"processName": "notes" }

Both forms keep working when you move the portable folder. A fixed path such as C:\tools\notes does not travel. In portable mode the Edit app dialog marks absolute cwd and url values with a “not portable” badge. See Portable mode.

env is an object of strings. The dialog edits it as one KEY=VALUE per line; it splits each line at the first =, trims both sides, and ignores lines without one.

In the dialog:

PORT=8091
NODE_ENV=development

In apps.json, as the env key of the entry:

apps.json (one entry)
{ "id": "habits", "name": "Habits", "group": "Web apps", "type": "web", "command": "python app.py",
"env": { "PORT": "8091", "NODE_ENV": "development" } }
  • The launched command inherits Moonpool’s environment plus env. Entries in env win.
  • env is also applied to stopCommand.
  • Values are used as written: no {MP_HOME} expansion and no %VAR% expansion by Moonpool.
  • Moonpool points its own WebView2 at a private profile folder through WEBVIEW2_USER_DATA_FOLDER. Launched apps do not inherit that. If you had set the variable yourself before starting Moonpool, they get your value; otherwise it is unset. An env entry can still override it.

The command and stopCommand run in cwd. When cwd is omitted, the command runs in Moonpool’s own working folder, so set cwd for anything that uses relative paths.

Moonpool is free software from FasterDB