defmodule Dough do @moduledoc false use Application import Supervisor.Spec import Cachex.Spec def start(_type, _args) do # List all child processes to be supervised children = [ # Starts a worker by calling: Dough.Worker.start_link(arg) # {Dough.Worker, arg}, # Plug.Adapters.Cowboy.child_spec(:https, Dough.Router, [], port: 8331, keyfile: "priv/ssl/localhost.key", certfile: "priv/ssl/localhost.crt", otp_app: :dough) worker(Cachex, [ :dough, [ expiration: expiration( default: :timer.seconds(6000), interval: :timer.seconds(300), lazy: true ) ] ]), {Plug.Adapters.Cowboy2, scheme: :https, plug: Dough.Router, options: [ port: 8331, otp_app: :dough, keyfile: "priv/ssl/localhost.key", certfile: "priv/ssl/localhost.crt" ]} ] # See https://hexdocs.pm/elixir/Supervisor.html # for other strategies and supported options opts = [strategy: :one_for_one, name: Dough.Supervisor] Supervisor.start_link(children, opts) end end