I have an elixir project with a defined version. How can I access this from within the running application.
in mix.exs
def project do
[app: :my_app
In recent versions of Elixir, the Application module now wraps this for you:
https://github.com/elixir-lang/elixir/blob/master/lib/elixir/lib/application.ex
Application.spec(:my_app, :vsn) |> to_string()
The Kernel.to_string()
method is necessary as Application.spec/2
for the keys :vsn
and :description
return charlists. to_string()
from the Kernel module converts them to a binary.