Configuration
Every value Fotobogen runs on is written down in one file, fotobogen.config.js. This page lists all of them: what each does, what you can change, and what you should leave alone.
How a setting is decided
For each setting, Fotobogen uses the first of these that has a value:
- An environment variable set when the app is started.
- The
.envfile in Fotobogen's folder. fotobogen.config.js, which holds the defaults.
So the file is the list of defaults, and .env is where you change them for one server.
Changing a setting: use .env
cp .env.sample .env # once; then edit .env
Write one setting to a line, such as PORT=8080, and restart Fotobogen. A restart is all a change to .env ever needs; nothing is rebuilt. Three reasons to do it this way and not edit the config file:
- It survives updates.
.envis yours and is never touched bygit pull. An editedfotobogen.config.jswill conflict with the next update. - It needs no rebuild.
.envis read each time Fotobogen starts. A change tofotobogen.config.jstakes effect only afterpnpm build. - It is never committed.
.envis in.gitignore;.env.sample, the template, is not.
| Running with | To restart after editing .env |
|---|---|
pnpm start | Stop it with Control + C, and run pnpm start again |
| pm2 | pm2 restart fotobogen |
| Docker | docker compose up -d, which starts the container again with the new values |
Two things to know. Under pm2, ecosystem.config.cjs takes the port from PORT in .env (5150 if it is not set); after changing it, run pm2 reload ecosystem.config.cjs --update-env, because pm2 remembers the port it was started with. That file also sets the address to listen on, the data folder, and TRUST_PROXY, which win over .env. Under Docker, the same .env file is read, and the compose files pass these settings through to the app: the upload limits, SITE_URL, ADMIN_HOST, DEMO_MODE, WEBHOOKS_ALLOW_PRIVATE, TWO_STEP_KEY, and TWO_STEP_KEY_FILE.
The two parts of the file
| Part | What is in it | Change it? |
|---|---|---|
| Okay to change | The port, the address, where data is kept, upload limits, webhooks | Yes. Each has a name to use in .env, except portAttempts. |
Do not touch (internals) | Image sizes, memory limits, queue and login rules, what a machine must have | No. They have no .env names on purpose. The app is built and tested around these values. |
Settings about the site (its title, its look, its words, what search engines are told) are not in this file at all. They are set in the admin and stored in the site's database. See Customization.
Okay to change: the server
server.port
| Default | 5150 |
|---|---|
In .env | PORT=5150 |
The port Fotobogen listens on. 5150 keeps clear of the ports other tools take first (3000, 8000, 8080).
- Left at its default and busy, Fotobogen tries the next port up (5151, 5152, and so on) and says which it took.
- Set by you, it is used exactly. If it is taken, Fotobogen stops and says so, instead of moving somewhere you did not ask for.
With Docker, this is the port on the host that is passed to the app (the Forge compose file), and the app inside the container always uses 5150.
server.portAttempts
| Default | 10 |
|---|---|
In .env | None. Change it in the file, then pnpm build. |
How many ports above the default to try before giving up. With the default, Fotobogen tries 5150 to 5159. There is rarely a reason to change it.
server.host
| Default | '0.0.0.0' (every network interface) |
|---|---|
In .env | HOST=127.0.0.1 |
The network address to listen on. 0.0.0.0 accepts connections from other machines. Use 127.0.0.1 when a proxy on the same machine (nginx, Caddy) is the only thing that should reach the app, so that nobody can go around the proxy.
server.trustProxy
| Default | false |
|---|---|
In .env | TRUST_PROXY=1 |
Tells Fotobogen that every request reaches it through your own reverse proxy, so the visitor's real address is in the X-Forwarded-For header and the scheme (http or https) in X-Forwarded-Proto. The login limit then counts failures by visitor, not by proxy.
Turn it on only when the app cannot be reached directly. If it is on and the app is exposed, anyone can send those headers themselves and dodge the login limit. The Docker and pm2 files that come with Fotobogen turn it on, because they put the app behind a proxy.
server.siteUrl
| Default | '' (none) |
|---|---|
In .env | SITE_URL=https://photos.example.com |
| In the admin | Search and sharing, "Your site's proper address" |
The site's proper address. It is used wherever a full address is written out: the links on a photo's admin page, canonical links, the RSS feed, the sitemap, and robots.txt.
- Left empty, the address each visitor used is given. On your own machine that is
http://localhost:5150, so links copied from the admin work only on that machine. - Only the address itself is kept:
https://photos.example.com/some/pagebecomeshttps://photos.example.com. - Anything that is not a web address is ignored.
- A value here or in
.envwins over the one in the admin, and the admin says so.
server.demoMode
| Default | false |
|---|---|
In .env | DEMO_MODE=1 |
For a site meant to show Fotobogen off. When it is on, the login page says the site is a demonstration, and anyone can log in with the username demo and the password demo.
- A demo visitor can look at everything and change nothing. They can open every admin page. Any request that would save, upload, or delete is refused by the server, so nothing a visitor does needs undoing.
- Your own login is unaffected and keeps full control. Use it to change the site.
- Kept from a demo visitor altogether: downloading a backup (it holds your login and every original file), restoring, updating Fotobogen, API tokens, webhooks, two-step login, private albums' links, and where photos were taken.
- What a demo visitor does see: everything else in the admin, including hidden and scheduled photos, their file names, and your settings. Do not switch this on for a site with anything in the admin you would not show a stranger.
- A demo login never touches the limit on wrong passwords: it is not counted as a failure and does not clear the count, so it cannot be used to get more guesses at your password. If your own account is called
demo, there is no demo login. - It is set on the server only. There is no switch for it in the admin, so a site cannot become a demo by accident. Switching it off ends every demo visitor's session at once.
Okay to change: where data is kept
dataDir
| Default | './data' |
|---|---|
In .env | DATA_DIR=/srv/photos |
The folder that holds everything the site owns: the database, your photographs as uploaded, the resized copies, and installed skins and modules. A path that does not start with / is taken from the folder Fotobogen is started in.
- Fotobogen must be able to create it and write to it, or it will not start.
- Put it on a disk with room for your photographs, and include it in your backups.
- Two copies of Fotobogen must never share one data folder.
pnpm startrefuses when it can see the other copy; it cannot see one run by another user or in another Docker container. - With Docker, leave this alone: the container always uses
/data, which the compose file maps to./dataon the host.
Okay to change: uploads
uploads.maxUploadMb
| Default | 50 |
|---|---|
In .env | MAX_UPLOAD_MB=120 |
The largest file accepted, in megabytes. A larger upload is refused with a message saying so.
If you raise it, raise the limit of the web server in front of Fotobogen too, or that will refuse the upload first with a less helpful message: max_size in deploy/Caddyfile, or client_max_body_size in nginx.
uploads.maxMegapixels
| Default | 100 |
|---|---|
In .env | MAX_MEGAPIXELS=60 |
The largest image accepted, in megapixels: its width times its height, divided by a million. A 9504 by 6336 photograph is 60 megapixels. This limit exists because a small file can unpack into an enormous image that fills the server's memory.
Lower it on a server with little memory. Raising it above 100 is safe only with memory to match. Four formats have their own lower limits, which this setting does not raise; see formatMegapixels.
Okay to change: webhooks
webhooks.allowPrivate
| Default | false |
|---|---|
In .env | WEBHOOKS_ALLOW_PRIVATE=1 |
A webhook sends a message to an address you enter in the admin. By default it may only call addresses on the public internet, so that a webhook cannot be pointed at this machine or at the private network behind it. The check is made again at the moment of connecting, so a name that changes what it points to does not get through.
Turn this on only if you want to call something on your own network, such as an automation tool on the same server.
Okay to change: two-step login
Two-step login is switched on in the admin, under Two-step login, not here. These two settings are in .env only, and only say where its key comes from. Most installs need neither.
TWO_STEP_KEY_FILE
| Default | .fotobogen/two-step-key.json in your home folder; in Docker, two-step-key.json in the data folder |
|---|---|
In .env | TWO_STEP_KEY_FILE=/path/to/two-step-key.json |
The file the key is kept in. Every Fotobogen that reads the same file shares one key, and so one entry in your authenticator app. Name a different file to give a site a key of its own. The file is made the first time two-step login is set up, readable by your account alone.
TWO_STEP_KEY
| Default | not set |
|---|---|
In .env | TWO_STEP_KEY=ABCD EFGH IJKL MNOP QRST UVWX YZ23 4567 |
The key itself, as an authenticator app shows it: letters A to Z and digits 2 to 7, at least 26 of them. When it is set, no file is used. It is for giving several Docker sites one entry in the app: set it in each site's .env. Changing it does not change a site that already has two-step login on: each site keeps its own copy from the moment it was switched on.
Do not touch: internals
These are listed so you can read them, not so you can tune them. The rest of the app is built and tested around these values. Changing one can break a site that already has photos, waste disk space, or run a small server out of memory. None has a name in .env. If one of them is wrong for you, that is worth raising as an issue, so it can be made a proper setting.
internals.derivatives: the resized copies
The sizes of the copies made of every photo, in pixels. Nothing is ever enlarged: a photo smaller than a size gets a copy at its own size.
| Setting | Value | What it is |
|---|---|---|
derivatives.thumbWidth | 480 | The thumbnail in the grid: this wide, whatever height keeps the photo's shape. |
derivatives.squareSize | 480 | The square crop used by the square grid, cut around the most interesting part of the photo. |
derivatives.mediumEdge | 1280 | The long side of the medium copy, shown on small screens and used as the sharing picture. |
derivatives.largeEdge | 2560 | The long side of the large copy, shown on large screens and handed out as a download. Also the size every photo is reduced to before anything else is done, which is what keeps memory use small. |
derivatives.webpQuality | thumb: 78, square: 78, medium: 82, large: 82 | How hard each copy is compressed as WebP, from 1 to 100. Higher is larger and closer to the original. These are the values of the Standard choice; to use others, choose Smaller files or High in the admin under Settings, Picture quality, which is the supported way to change them. |
derivatives.previewEdge | 1024 | The size of the unsaved previews in the admin, when trying a look. |
Why not to change them: photos already processed keep the sizes they were made at, so a change leaves a site with a mixture. The skins' layouts and the sharing cards assume these sizes. A larger largeEdge raises memory use for every photo.
internals.formatMegapixels
| Format | Limit, in megapixels |
|---|---|
avif | 16 |
webp | 60 |
interlaced png | 40 |
heic | 25 |
JPEG, ordinary PNG, and TIFF can be read a strip at a time. These four formats must be held whole in memory to open, so they are held to smaller sizes. The limits were measured so that one photo stays under about 450 MB. A larger file in one of these formats is refused with a note to upload a JPEG instead.
HEIC, the format an iPhone saves in, is decoded in a process of its own, measured at about 130 MB plus 11 MB for each megapixel, all of it given back when the photo is done. An iPhone's usual 12 or 24 megapixels fit (24 takes about 400 MB); its 48-megapixel setting does not, on a server this small.
Why not to change them: raising one can crash a 1 GB server in the middle of an upload.
internals.moduleOutputMegapixels
Value: 40. The largest picture a module may produce. A module can make a photo bigger (the film frame adds a border); this stops a faulty or careless one from producing an image that fills memory or disk.
internals.queue
| Setting | Value | What it is |
|---|---|---|
queue.maxAttempts | 3 | How many times a photo is tried before it is marked failed. A failed photo's page in the library shows the reason and a Try again button, and the uploaded file is kept. |
internals.auth: logging in
| Setting | Value | What it is |
|---|---|---|
auth.sessionDays | 30 | How long a login lasts without being used. Each use renews it for another 30 days, but never beyond 90 days from when the login was made. |
auth.maxFailures | 5 | Wrong passwords, or wrong setup tokens, allowed from one address… |
auth.failureWindowMinutes | 15 | …within this many minutes, before that address has to wait. |
auth.passwordMinLength | 12 | The shortest password accepted, in the setup wizard, in the browser, and by reset-admin. |
Why not to change them: these are the site's defences against password guessing. Loosening them makes the one account that controls the site easier to break into.
internals.samples: the sample photos
| Setting | Value | What it is |
|---|---|---|
samples.source | 'https://picsum.photos' | Where the 25 sample photographs are downloaded from, when you ask for them. |
samples.timeoutSeconds | 20 | How long to wait for each one. |
samples.giveUpAfter | 3 | If this many in a row fail at the start, the service is treated as unreachable and the download stops, so nobody waits through 25 failures. |
internals.requirements: what a machine must have
The figures the preflight check uses each time Fotobogen starts. Below a fail figure it refuses to run; below a warn figure it runs and says what to improve.
| Setting | Value | What it is |
|---|---|---|
requirements.nodeMajor | 24 | The oldest version of Node.js it will run on. |
requirements.memoryMb | fail: 900, warn: 1900 | Memory available, in megabytes. In a container, the container's limit counts, not the host's. |
requirements.freeDiskMb | fail: 500, warn: 2000 | Free space on the disk holding the data folder, in megabytes. |
requirements.platforms | linux, darwin (macOS), win32 (Windows) | The systems it is tested on. Another one gets a warning, not a refusal. |
requirements.architectures | x64, arm64 | The processors its image and database libraries are built for. Another one is refused. |
requirements.linuxFamilies | debian, ubuntu | The Linux families it is tested on. Another one gets a warning that it is untested. |
Why not to change them: the check exists so that an installation never half-works. To start anyway on a machine that fails it, at your own risk, there is a setting for exactly that, below.
Settings that exist only in .env
These are not in fotobogen.config.js, because they are about one start of the app or about Docker, not about the app itself.
| Setting | What it does |
|---|---|
FOTOBOGEN_NO_QUESTIONS=1 | The first start in a terminal asks nothing and uses the defaults. Give it when starting (FOTOBOGEN_NO_QUESTIONS=1 pnpm start), not in .env: once .env exists nothing is asked anyway. (Nothing is ever asked under pm2, in Docker, or from a script.) |
NO_COLOR=1 | Plain text with no colour in the terminal. Give it when starting (NO_COLOR=1 pnpm start), not in .env. |
FOTOBOGEN_SKIP_PREFLIGHT=1 | Starts even when the preflight check fails. At your own risk: the check failed for a reason, and the usual result is a site that runs out of memory or disk while processing a photo. It does not reach a Docker container. |
DOMAIN | Docker quick start only. The domain name Caddy gets an HTTPS certificate for. Left unset, the site is plain HTTP on localhost. |
PUID, PGID | Docker only. The user and group that own the files in data. Use what id -u and id -g print; 1000 is the usual first user on Linux. |
Every setting at a glance
| In the file | Default | In .env | Change it? |
|---|---|---|---|
server.port | 5150 | PORT | Yes |
server.portAttempts | 10 | none | Rarely needed |
server.host | 0.0.0.0 | HOST | Yes |
server.trustProxy | false | TRUST_PROXY | Only behind your own proxy |
server.siteUrl | none | SITE_URL | Yes, on a public site |
server.demoMode | false | DEMO_MODE | Only on a demonstration site |
dataDir | ./data | DATA_DIR | Yes |
uploads.maxUploadMb | 50 | MAX_UPLOAD_MB | Yes, with the proxy's limit |
uploads.maxMegapixels | 100 | MAX_MEGAPIXELS | Yes, with memory to match |
webhooks.allowPrivate | false | WEBHOOKS_ALLOW_PRIVATE | Only for your own network |
none (in .env only) | not set | ADMIN_HOST | Yes: the admin at an address of its own |
none (in .env only) | a file in your home folder | TWO_STEP_KEY_FILE | Rarely needed |
none (in .env only) | not set | TWO_STEP_KEY | Only to share one authenticator entry between Docker sites |
internals.derivatives | see above | none | No |
internals.formatMegapixels | 16, 60, 40, 25 | none | No |
internals.moduleOutputMegapixels | 40 | none | No |
internals.queue | 3 attempts | none | No |
internals.auth | see above | none | No |
internals.samples | see above | none | No |
internals.requirements | see above | none | No |
The file itself, with a comment on every value, is fotobogen.config.js.