Application version on Phoenix

Is there an elegant way to access to the application version?

I’m serving the app version through an endpoint like this

def version(conn, _param) do
  [_,_,{:vsn, version}|_] = Application.spec(:app_name)
  text conn, version
end
@version Mix.Project.config()[:version]

def version(conn, _param) do
  text conn, @version
end
1 Like

Application.spec(:app_name, :vsn)

5 Likes

@michalmuskala @NobbZ Thanks, both answers are useful.