2 Configuration
systemexit edited this page 2024-10-15 05:34:23 +00:00

Environment Variables

Supported environment variables are defined in config/parse.go.
Their defaults are derived from options defined in config/options.go.

Variable Default
BASE_URL "http://localhost:8080"
DATABASE_URL "./selfster.db"
NO_MIGRATE "false"
LISTEN_ADDR "127.0.0.1:8080"
SMTP_URL "127.0.0.1:1025"
SMTP_USER ""
SMTP_PASS ""
SMTP_FROM ""
REVERSE_PROXY_HTTPS "false"

To override a default, export it to the shell environment or define it inline (e.g., using env)

Note

Most of the time that you want to change the listen address you likely also need to change the base URL to ensure the port matches and you can route to the host.

# Change port to 8888
$ env LISTEN_ADDR='127.0.0.1:8888' BASE_URL='http://localhost:8888' mage -v run

# Change listen address to allow remote connections by hostname
$ PORT=8080
$ export LISTEN_ADDR="$(ip route | awk 'BEGIN{ src=9 } /^default/{ print $src }'):${PORT}"
$ export BASE_URL="http://$(hostname -f):8080"
$ mage -v run