# Flow settings, config file and folders

> The settings of Flow (name, components and templates catalogues, environment, backup, tokens), the lines of the config file, the environment of the streams and the folders for extensions and local components.

Framework: flow
Product: Flow (flow@11.1)
Language: en
Content-SHA256: 52a070f7013e82504d2350a59a14b4bae3a3cbc0d460f3d3b237dde3e5b44741
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: 
Review: not-recorded

## The `config` file

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

| Line | Meaning |
|---|---|
| `name` | the name shown by the application (it can be changed in the settings) |
| `$api : /fapi/` | the address of the JSON API |
| `flowstream_worker : fork` | each FlowStream runs in its own process |
| `$proxytimeout : 120` | seconds that a stream may take to answer an HTTP request |
| `cookie`, `cookie_secret` | generated 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](/en/flow/manage-flowstreams-with-the-api/));
- **darkmode** and **notify**;
- **op_reqtoken** and **op_restoken**: the tokens of an [OpenPlatform](/en/openplatform/how-an-app-connects/); 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](/en/flow/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`.
