(defmodule nemoptera_app
(behaviour application)
(export all))
(defun start (_type _args)
(if (nemoptera_setup:installed?)
(progn
(nemoptera_config:reload)
(case (nemoptera_db:open)
(`#(ok ,_) 'ok)
(`#(error ,reason)
(logger:error "platform database did not open: ~p" (list reason)))))
'ok)
(case (nemoptera_sup:start_link)
(`#(ok ,sup)
(case (nova_sup:add_application 'nemoptera #M(port 8731))
(`#(ok ,_app ,_host ,_port) `#(ok ,sup))
(`#(error ,reason)
(logger:error "routes were not registered: ~p" (list reason))
`#(error ,reason))))
(other other)))
(defun prep-stop (state) state)
(defun stop (_state) 'ok)