Access project version within elixir application

后端 未结 6 1102
挽巷
挽巷 2021-02-12 07:42

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         


        
6条回答
  •  隐瞒了意图╮
    2021-02-12 08:25

    Mix.Project itself provides access to all project keywords defined in mix.exs using its config/0 (api doc) function. For concise access it might be wrapped into a function:

    @version Mix.Project.config[:version]
    def version(), do: @version
    

提交回复
热议问题