From 1e66243ad9ebdf143afe8dcf7ac0f9934097add0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 2 Feb 2023 10:52:16 +0100 Subject: [PATCH] Allow configuring desktop env vars (#1676) --- README.md | 9 +++++++++ rel/app/env.bat.eex | 4 ++++ rel/app/env.sh.eex | 4 ++++ 3 files changed, 17 insertions(+) diff --git a/README.md b/README.md index c169e11a9..5d9ce784e 100644 --- a/README.md +++ b/README.md @@ -231,6 +231,15 @@ The following environment variables configure Livebook: +When running Livebook Desktop, Livebook will invoke on boot a file named +`~/.livebookdesktop.sh` on macOS or `%USERPROFILE%\.livebookdesktop.bat` +on Windows. This file can set environment variables used by Livebook, +such as [the `PATH` environment variable](https://en.wikipedia.org/wiki/PATH_(variable)), +or to configure the Erlang VM, for instance, by setting +`ERL_AFLAGS="-proto_dist inet6_tcp"` if you need Livebook to run over IPv6. +Be careful when modifying said files, Livebook may be unable to start if +configured incorrectly. + If running Livebook via the command line, run `livebook server --help` to see all CLI-specific options. diff --git a/rel/app/env.bat.eex b/rel/app/env.bat.eex index 74790c376..bda676869 100644 --- a/rel/app/env.bat.eex +++ b/rel/app/env.bat.eex @@ -1,3 +1,7 @@ +if exist "!USERPROFILE!\.livebookdesktop.bat" ( + call "!USERPROFILE!\.livebookdesktop.bat" +) + set RELEASE_NODE=livebook_app set RELEASE_MODE=interactive set MIX_ARCHIVES=!RELEASE_ROOT!\vendor\archives diff --git a/rel/app/env.sh.eex b/rel/app/env.sh.eex index 00027d49a..a98997dd5 100644 --- a/rel/app/env.sh.eex +++ b/rel/app/env.sh.eex @@ -1,3 +1,7 @@ +if [ -f "$HOME/.livebookdesktop.sh" ]; then + . "$HOME/.livebookdesktop.sh" +fi + export RELEASE_NODE=livebook_app export RELEASE_MODE=interactive export MIX_ARCHIVES="${RELEASE_ROOT}/vendor/archives"