Add configuration for update check to target a different repository (#2743)

This commit is contained in:
a-maze-d 2024-08-15 09:08:01 +02:00 committed by Jonatan Kłosko
parent 0c00f74dbf
commit 0bfb7ea95c
3 changed files with 9 additions and 1 deletions

View file

@ -38,6 +38,7 @@ config :livebook,
shutdown_callback: nil, shutdown_callback: nil,
teams_auth?: false, teams_auth?: false,
teams_url: "https://teams.livebook.dev", teams_url: "https://teams.livebook.dev",
github_release_repo: "livebook-dev/livebook",
update_instructions_url: nil, update_instructions_url: nil,
within_iframe: false within_iframe: false

View file

@ -425,6 +425,13 @@ defmodule Livebook.Config do
""" """
def app_version(), do: @app_version def app_version(), do: @app_version
@doc """
Returns the GitHub org/repo where the releases are created.
"""
def github_release_repo() do
Application.get_env(:livebook, :github_release_repo)
end
@doc """ @doc """
Aborts booting due to a configuration error. Aborts booting due to a configuration error.
""" """

View file

@ -128,7 +128,7 @@ defmodule Livebook.UpdateCheck do
end end
defp fetch_latest_version() do defp fetch_latest_version() do
url = "https://api.github.com/repos/livebook-dev/livebook/releases/latest" url = "https://api.github.com/repos/#{Livebook.Config.github_release_repo()}/releases/latest"
headers = [{"accept", "application/vnd.github.v3+json"}] headers = [{"accept", "application/vnd.github.v3+json"}]
case Livebook.Utils.HTTP.request(:get, url, headers: headers) do case Livebook.Utils.HTTP.request(:get, url, headers: headers) do