···2424 end
2525 end
2626 end
2727+2828+ # TODO: this should really be somewhere related to an api
2929+ def config(conn, _params) do
3030+ with {:ok, nix_caches} <- Application.fetch_env(:sower, :nix_caches) do
3131+ # convert back to list of maps
3232+ nix_caches = nix_caches |> Enum.map(&(&1 |> Enum.into(%{})))
3333+3434+ conn
3535+ |> put_root_layout(false)
3636+ |> json(%{nix_caches: nix_caches})
3737+ end
3838+ end
2739end
+2
lib/sower_web/router.ex
···46464747 scope "/api" do
4848 pipe_through :api
4949+ get "/config", SowerWeb.AppController, :config
5050+4951 get "/seeds", SowerWeb.SeedController, :list
5052 get "/seeds/latest", SowerWeb.SeedController, :find_latest
5153 post "/seeds", SowerWeb.SeedController, :new