mirror of
https://github.com/livebook-dev/livebook.git
synced 2024-09-20 01:55:56 +08:00
Make Livebook version accessible at compile time (#2280)
Co-authored-by: José Valim <jose.valim@dashbit.co>
This commit is contained in:
parent
b5092c1f9f
commit
5d78db66e5
|
@ -613,10 +613,12 @@ defmodule Livebook.Config do
|
|||
end
|
||||
end
|
||||
|
||||
@app_version Mix.Project.config()[:version]
|
||||
|
||||
@doc """
|
||||
Returns the current version of running Livebook.
|
||||
"""
|
||||
def app_version, do: Application.spec(:livebook, :vsn) |> List.to_string()
|
||||
def app_version(), do: @app_version
|
||||
|
||||
defp parse_connection_config!(config) do
|
||||
{node, cookie} = split_at_last_occurrence(config, ":")
|
||||
|
|
|
@ -85,7 +85,7 @@ defmodule Livebook.Hubs.TeamClient do
|
|||
derived_key = Teams.derive_key(team.teams_key)
|
||||
|
||||
headers = [
|
||||
{"x-lb-version", to_string(Application.spec(:livebook, :vsn))},
|
||||
{"x-lb-version", Livebook.Config.app_version()},
|
||||
{"x-user", to_string(team.user_id)},
|
||||
{"x-org", to_string(team.org_id)},
|
||||
{"x-org-key", to_string(team.org_key_id)},
|
||||
|
|
|
@ -149,7 +149,7 @@ defmodule Livebook.Teams.Requests do
|
|||
token = "#{team.user_id}:#{team.org_id}:#{team.org_key_id}:#{team.session_token}"
|
||||
|
||||
[
|
||||
{"x-lb-version", to_string(Application.spec(:livebook, :vsn))},
|
||||
{"x-lb-version", Livebook.Config.app_version()},
|
||||
{"authorization", "Bearer " <> token}
|
||||
]
|
||||
end
|
||||
|
|
|
@ -73,7 +73,7 @@ defmodule LivebookCLI do
|
|||
IO.puts(:erlang.system_info(:system_version))
|
||||
IO.puts("Elixir " <> System.build_info()[:build])
|
||||
|
||||
version = Application.spec(:livebook, :vsn)
|
||||
version = Livebook.Config.app_version()
|
||||
IO.puts("\nLivebook #{version}")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -141,9 +141,9 @@ defmodule LivebookWeb.AppHelpers do
|
|||
|
||||
defp zta_options(), do: @zta_options
|
||||
|
||||
defp docker_tag_options() do
|
||||
for image <- Livebook.Config.docker_images(), do: {image.tag, image.name}
|
||||
end
|
||||
@docker_tag_options for image <- Livebook.Config.docker_images(), do: {image.tag, image.name}
|
||||
|
||||
defp docker_tag_options(), do: @docker_tag_options
|
||||
|
||||
@doc """
|
||||
Renders Docker deployment instruction for an app.
|
||||
|
|
|
@ -94,7 +94,7 @@ defmodule LivebookWeb.LayoutHelpers do
|
|||
</span>
|
||||
</.link>
|
||||
<span class="text-gray-300 text-xs font-normal font-sans mx-2.5 pt-3 cursor-default">
|
||||
v<%= Application.spec(:livebook, :vsn) %>
|
||||
v<%= Livebook.Config.app_version() %>
|
||||
</span>
|
||||
</div>
|
||||
<.sidebar_link title="Home" icon="home-6-line" to={~p"/"} current={@current_page} />
|
||||
|
|
|
@ -60,7 +60,7 @@ defmodule LivebookWeb.SettingsLive do
|
|||
<% end %>
|
||||
</.labeled_text>
|
||||
<.labeled_text label="Livebook">
|
||||
v<%= Application.spec(:livebook, :vsn) %>
|
||||
v<%= Livebook.Config.app_version() %>
|
||||
</.labeled_text>
|
||||
<.labeled_text label="Elixir">
|
||||
v<%= System.version() %>
|
||||
|
|
Loading…
Reference in a new issue