cardinal

Settings and ports

Perch's environment variables, its port, and how to put it behind a password.

Perch listens on 127.0.0.1:4100 with no login by default.

Environment variables

VariableDefaultWhat it does
CARDINAL_WORKSPACErequiredThe workspace folder
CARDINAL_DATABASE_URLrequiredThe workspace's database, ecto://USER:PASS@HOST:PORT/DB. Perch's connection is read-only
PERCH_PORT4100The port. cardinal start --verbose and cardinal perch pass it through
PERCH_BIND127.0.0.1The address. Any other address needs PERCH_PASSWORD_HASH, or Perch stops at boot and says why
PERCH_PASSWORD_HASHunsetAn Argon2 hash. Turns on a login page and a session cookie for every page
SECRET_KEY_BASEmade at boot in devSigns cookies. In dev, which bin/perch runs by default, a key made at boot means a restart signs everyone out. Required in prod
CARDINAL_HOMEfrom the workspace's mix.exsThe Cardinal checkout, used to find bin/cardinal and the load scripts

The Frappe migrator also defaults to port 4100. Set PERCH_PORT to another port if both run on one machine.

Reach Perch from another machine

Hash a password:

mix perch.hash 'a long password'      # prints $argon2id$v=19$...

Start Perch with the hash and an address. Single quotes keep the hash's $ signs.

PERCH_PASSWORD_HASH='$argon2id$v=19$...' PERCH_BIND=0.0.0.0 bin/perch

Five failed logins from one address in a minute block that address for the rest of the minute. The sixth attempt is refused before the hash check.

On this page