mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-09-13 16:34:45 +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
7 changed files with 11 additions and 9 deletions
|
@ -613,10 +613,12 @@ defmodule Livebook.Config do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@app_version Mix.Project.config()[:version]
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Returns the current version of running Livebook.
|
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
|
defp parse_connection_config!(config) do
|
||||||
{node, cookie} = split_at_last_occurrence(config, ":")
|
{node, cookie} = split_at_last_occurrence(config, ":")
|
||||||
|
|
|
@ -85,7 +85,7 @@ defmodule Livebook.Hubs.TeamClient do
|
||||||
derived_key = Teams.derive_key(team.teams_key)
|
derived_key = Teams.derive_key(team.teams_key)
|
||||||
|
|
||||||
headers = [
|
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-user", to_string(team.user_id)},
|
||||||
{"x-org", to_string(team.org_id)},
|
{"x-org", to_string(team.org_id)},
|
||||||
{"x-org-key", to_string(team.org_key_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}"
|
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}
|
{"authorization", "Bearer " <> token}
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
|
@ -73,7 +73,7 @@ defmodule LivebookCLI do
|
||||||
IO.puts(:erlang.system_info(:system_version))
|
IO.puts(:erlang.system_info(:system_version))
|
||||||
IO.puts("Elixir " <> System.build_info()[:build])
|
IO.puts("Elixir " <> System.build_info()[:build])
|
||||||
|
|
||||||
version = Application.spec(:livebook, :vsn)
|
version = Livebook.Config.app_version()
|
||||||
IO.puts("\nLivebook #{version}")
|
IO.puts("\nLivebook #{version}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -141,9 +141,9 @@ defmodule LivebookWeb.AppHelpers do
|
||||||
|
|
||||||
defp zta_options(), do: @zta_options
|
defp zta_options(), do: @zta_options
|
||||||
|
|
||||||
defp docker_tag_options() do
|
@docker_tag_options for image <- Livebook.Config.docker_images(), do: {image.tag, image.name}
|
||||||
for image <- Livebook.Config.docker_images(), do: {image.tag, image.name}
|
|
||||||
end
|
defp docker_tag_options(), do: @docker_tag_options
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Renders Docker deployment instruction for an app.
|
Renders Docker deployment instruction for an app.
|
||||||
|
|
|
@ -94,7 +94,7 @@ defmodule LivebookWeb.LayoutHelpers do
|
||||||
</span>
|
</span>
|
||||||
</.link>
|
</.link>
|
||||||
<span class="text-gray-300 text-xs font-normal font-sans mx-2.5 pt-3 cursor-default">
|
<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>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<.sidebar_link title="Home" icon="home-6-line" to={~p"/"} current={@current_page} />
|
<.sidebar_link title="Home" icon="home-6-line" to={~p"/"} current={@current_page} />
|
||||||
|
|
|
@ -60,7 +60,7 @@ defmodule LivebookWeb.SettingsLive do
|
||||||
<% end %>
|
<% end %>
|
||||||
</.labeled_text>
|
</.labeled_text>
|
||||||
<.labeled_text label="Livebook">
|
<.labeled_text label="Livebook">
|
||||||
v<%= Application.spec(:livebook, :vsn) %>
|
v<%= Livebook.Config.app_version() %>
|
||||||
</.labeled_text>
|
</.labeled_text>
|
||||||
<.labeled_text label="Elixir">
|
<.labeled_text label="Elixir">
|
||||||
v<%= System.version() %>
|
v<%= System.version() %>
|
||||||
|
|
Loading…
Add table
Reference in a new issue