application.ex (2292B)
1 # Zenflows is designed to implement the Valueflows vocabulary, 2 # written and maintained by srfsh <info@dyne.org>. 3 # Copyright (C) 2021-2023 Dyne.org foundation <foundation@dyne.org>. 4 # 5 # This program is free software: you can redistribute it and/or modify 6 # it under the terms of the GNU Affero General Public License as published by 7 # the Free Software Foundation, either version 3 of the License, or 8 # (at your option) any later version. 9 # 10 # This program is distributed in the hope that it will be useful, 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 # GNU Affero General Public License for more details. 14 # 15 # You should have received a copy of the GNU Affero General Public License 16 # along with this program. If not, see <https://www.gnu.org/licenses/>. 17 18 defmodule Zenflows.Application do 19 @moduledoc false 20 use Application 21 22 @impl true 23 def start(_type, _args) do 24 print_header() 25 26 migrate() 27 28 children = [ 29 Zenflows.DB.Repo, 30 Zenflows.InstVars.Domain, 31 Zenflows.Restroom, 32 Zenflows.DID, 33 {Plug.Cowboy, scheme: :http, plug: Zenflows.Web.Router, options: [port: 8000]}, 34 ] 35 36 opts = [strategy: :one_for_one, name: Zenflows.Supervisor] 37 Supervisor.start_link(children, opts) 38 end 39 40 defp print_header() do 41 unless System.get_env("NOHEADER") do 42 IO.puts(""" 43 Zenflows is designed to implement the Valueflows vocabulary, 44 written and maintained by srfsh <info@dyne.org>. 45 Copyright (C) 2021-2023 Dyne.org foundation <foundation@dyne.org>. 46 47 This program is free software: you can redistribute it and/or modify 48 it under the terms of the GNU Affero General Public License as published by 49 the Free Software Foundation, either version 3 of the License, or 50 (at your option) any later version. 51 52 This program is distributed in the hope that it will be useful, 53 but WITHOUT ANY WARRANTY; without even the implied warranty of 54 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 55 GNU Affero General Public License for more details. 56 57 You should have received a copy of the GNU Affero General Public License 58 along with this program. If not, see <https://www.gnu.org/licenses/>. 59 """) 60 end 61 end 62 63 defp migrate() do 64 unless System.get_env("NOMIGRATE"), 65 do: Zenflows.Reltask.migrate() 66 end 67 end