ForgeFlow
en

Flow

Flow settings, config file and folders

Flow · flow@11.1 flowsettingsconfigextensionsenv

The config file

The file config in the root of Flow holds the options of the application. The ones that matter:

LineMeaning
namethe name shown by the application (it can be changed in the settings)
$api : /fapi/the address of the JSON API
flowstream_worker : forkeach FlowStream runs in its own process
$proxytimeout : 120seconds that a stream may take to answer an HTTP request
cookie, cookie_secretgenerated at the first start and kept in databases/config.json

Other options are read when they exist: directory (the folder of the streams; the default is flowstream/ next to the application), flowstream_memory (a default memory limit for new streams), flowstream_sandbox and flowstream_asfiles (they are passed to every stream), components and templates (the first values of the catalogues) and backup.

Settings in the application

The super administrator opens the settings and finds:

  • name of the installation;
  • components and components2: the address of the catalogue of components (a db.json file, by default https://cdn.totaljs.com/flowstream/webcomponents/db.json) and an optional second catalogue, so you can offer your own components next to the official ones;
  • templates: the catalogue of templates of streams (by default https://cdn.totaljs.com/flowstream/templates/db.json);
  • env: dev, test or prod. The streams read it, and changing it restarts all of them one by one;
  • backup: each save of the streams renames the previous database.json to a file with the date and the minute, database_yyyyMMddHHmm.bk;
  • token: the random token for /private/ (see the API);
  • darkmode and notify;
  • op_reqtoken and op_restoken: the tokens of an OpenPlatform; when both are set, people sign in with that OpenPlatform.

Plugins can add their own settings to the same form. The repository includes one, Bookmarks, a list of saved components that people with the permission bookmarks can use.

Variables

Every stream has its own variables and there is a set of global variables, both edited in the editor or with Variables|read and Variables|save. A component reads them to avoid putting addresses and keys in the design, and a change reaches the running streams at once.

Local components: --components--

The folder --components-- of the repository holds a few components that travel with the application: checkfreespace, checklog, checkpg, checkurl, console and print. The official catalogue is much bigger, see the components repository.

Extensions

An extension adds something to the editor of every stream. Copy an .html file to the folder extensions/ (the repository documents it in --extensions--/ with a test.html sample) and Flow loads it for each stream: the part between <script total> and </script> runs with the stream, and the rest of the file is added to the editor.

The environment of a stream

At the start of each stream Flow gives it the folder where it keeps its files (directory), the global variables, the env of the installation, its memory limit, and the extensions loader (extensions.js). A stream that crashes is restarted by Flow, and its statistics (messages, pending, errors, memory and process id) are returned by Streams.