Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Livebook version accessible at compile time #2280

Merged
merged 4 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/livebook/config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ defmodule Livebook.Config do
@doc """
Returns the current version of running Livebook.
"""
def app_version, do: Application.spec(:livebook, :vsn) |> List.to_string()
def app_version(), do: Mix.Project.config()[:version]
jonatanklosko marked this conversation as resolved.
Show resolved Hide resolved

defp parse_connection_config!(config) do
{node, cookie} = split_at_last_occurrence(config, ":")
Expand Down
2 changes: 1 addition & 1 deletion lib/livebook/hubs/team_client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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)},
Expand Down
2 changes: 1 addition & 1 deletion lib/livebook/teams/requests.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/livebook_cli.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions lib/livebook_web/live/app_helpers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion lib/livebook_web/live/layout_helpers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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} />
Expand Down
2 changes: 1 addition & 1 deletion lib/livebook_web/live/settings_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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() %>
Expand Down
Loading