Skip to content

Environment Variables

Adam Dullage edited this page Sep 28, 2023 · 9 revisions

FLATNOTES_PATH

The path to the directory in which notes are/should be stored.

Required when not using the Docker image. Defaults to /data (within the container) when using the Docker image.

FLATNOTES_AUTH_TYPE

There are currently 3 types of authentication supported:

  • none - No authentication.
  • read_only - As above but note creation, modification and deletion is disabled.
  • password - A username and password is required to access flatnotes. See FLATNOTES_USERNAME and FLATNOTES_PASSWORD below.
  • totp - In addition to a username and password, a time based one-time-password is also required to access flatnotes.

Defaults to password if not provided.

totp

To use the totp authentication type you will also need to supply a FLATNOTES_TOTP_KEY (see below). Upon startup, flatnotes will print a QR code which can be used to add flatnotes to an authentication app such as Authy or Google Authenticator. Docker users can view this QR code by looking at the containers logs e.g. docker logs flatnotes.

If for any reason you are unable to scan the QR code, you can also manually enter the secret key into your authentication app. This will be printed underneath the QR code in the logs.

When using the API with totp enabled, you'll need to append the current totp code to your password (e.g. changeMe!123456) when calling the /api/token endpoint.

FLATNOTES_USERNAME & FLATNOTES_PASSWORD

The username and password used to access flatnotes.

Required when FLATNOTES_AUTH_TYPE is set to password or totp. Not applicable when FLATNOTES_AUTH_TYPE is set to none or read_only.

FLATNOTES_SECRET_KEY

The secret key used to generate access tokens. Changing this will invalidate all existing access tokens.

I recommend using a password generator to generate random 32 character string.

Required when FLATNOTES_AUTH_TYPE is set to password or totp. Not applicable when FLATNOTES_AUTH_TYPE is set to none or read_only.

FLATNOTES_SESSION_EXPIRY_DAYS

Defines how many days an access token is valid for (before a username, password and (possibly) a totp code is required to login again).

Defaults to 30 if not provided.

FLATNOTES_TOTP_KEY

The secret key used to generate totp codes. Changing this will invalidate the totp configuration.

I recommend using a password generator to generate random 32 character string.

Required when FLATNOTES_AUTH_TYPE is totp. Not applicable for other authentication types.

PUID & PGID

These are applicable to the Docker image only.

They allow you to specify the user and group that flatnotes will run as inside the Docker container. This is useful to avoid permission issues when mounting a directory from the host.

Both default to 1000.

Values are ignored if the container is not run as root (e.g. when using the docker --user flag).