From 529339c8a215fcaf61c55a4c088ce7c0dad992df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonatan=20K=C5=82osko?= Date: Fri, 29 Oct 2021 20:49:25 +0200 Subject: [PATCH] Remove configuration env vars on boot (#662) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Remove configuration env vars on boot * Update lib/livebook/application.ex Co-authored-by: José Valim Co-authored-by: José Valim --- lib/livebook/application.ex | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/livebook/application.ex b/lib/livebook/application.ex index 43eb91ff2..17bd573b1 100644 --- a/lib/livebook/application.ex +++ b/lib/livebook/application.ex @@ -30,6 +30,7 @@ defmodule Livebook.Application do opts = [strategy: :one_for_one, name: Livebook.Supervisor] with {:ok, _} = result <- Supervisor.start_link(children, opts) do + clear_env_vars() display_startup_info() result end @@ -144,4 +145,14 @@ defmodule Livebook.Application do IO.puts("[Livebook] Application running at #{LivebookWeb.Endpoint.access_url()}") end end + + defp clear_env_vars() do + for {var, _} <- System.get_env(), config_env_var?(var) do + System.delete_env(var) + end + end + + defp config_env_var?("LIVEBOOK_" <> _), do: true + defp config_env_var?("RELEASE_" <> _), do: true + defp config_env_var?(_), do: false end