Using environment variables with PhotoStructure
You can use environment
variables to configure
PhotoStructure’s settings. The
file describes all of PhotoStructure’s settings, and how to change each with an
environment variable. This file will also be found in your root app directory
(from version 0.9.0 and later) if you’re using a PhotoStructure for
You can edit your
settings.tomlfiles and set environment variables.
Environment variables always override any values found in
As of version 2.1 (due to be released soon), PhotoStructure will read from one or more files specified in your
PS_ENV_FILEenvironment variable. See below for details.
Environment variable overrides and settings.toml values don’t mix #
PhotoStructure does not write environment variables overrides to your
This is actually by design: previous versions of PhotoStructure didn’t
settings.toml values and environment variable overrides.
As an example, if you had set
PS_LOG_LEVEL=debug and then saved your settings
via the web UI, that
debug value would get persisted and become the new
default log level.
This behavior was surprising and confusing to most beta users. Thanks to the
principle of least
decided that this was a “bug,” not a “feature,” and changed PhotoStructure to
keep environment variable overrides separated from values stored in the
Boolean settings #
Boolean settings interpret either
Converting between settings names and environment variable names #
To avoid name-colliding with other software, all PhotoStructure environment
variables are prefixed with
PS_ and converted to
PS_LOG_LEVELenvironment variable overrides the
PS_LIBRARY_PATHenvironment variable overrides the
Caution: upgrades to your environment variables are not automatic #
When you upgrade to a new version of PhotoStructure, your prior
files are automatically migrated to contain the settings (and defaults) of the
new version, while retaining your custom configurations.
We can’t do this for environment variables, though, as we don’t know where your environment variables are coming from, as they can be set in many different ways.
If you’re using environment variables, it’s up to you to review our release notes and make suitable settings changes when you upgrade. We mark any settings that are deleted, renamed, or have changed semantics with a 💔.
It also might be helpful to look at differences between version tags on github.
How to set environment variables per OS #
PhotoStructure for Desktops on macOS #
If you’re using PhotoStructure for Desktops on macOS, you can set environment variables with
To disable video transcoding, for example, open a terminal and run:
launchctl setenv PS_TRANSCODE_VIDEOS false
To get the current value, use
launchctl getenv PS_TRANSCODE_VIDEOS
To unset (and use PhotoStructure’s default), use
launchctl unsetenv PS_TRANSCODE_VIDEOS
PhotoStructure for Servers on Linux and macOS #
Add environment variables to the relevant RC script for your shell. If you’re using
PhotoStructure on Windows #
- Hit the
Windowskey, and type “environment”,
- select “Edit the system environment variables” control panel,
- click the
Environment Variables...button in the bottom right, and
- click the top
New...button. Pick the top
New...button if you’re using PhotoStructure for Desktops. If you’re running PhotoStructure as a system service, pick the bottom
With docker, use
docker run docker run --name photostructure --env PS_LOG_LEVEL=info ...
With docker-compose, use the
... environment: - "PS_LOG_LEVEL=info" ...
Alternative coming in v2.1: Support for
.env files #
Version 2.1 adds support for reading
.env files via the new
PS_ENV_FILE environment variable.
The value you give to
PS_ENV_FILEmust be a full pathname to the file you want to import.
Multiple files may be specified. Use your OS’es delimiter (
:on Linux and macOS,
;on Windows) to separate the paths.
If the same value is defined in multiple
.envfiles, the last path specified will “win.”
.env file format #
PhotoStructure reads standard
# This is a comment PS_LIBRARY_DIR="/path/to your/library" PS_LOG_LEVEL="info"