You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.1 KiB
42 lines
1.1 KiB
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
|
|
|