Skip to content

Instantly share code, notes, and snippets.

@mpugach
Created February 18, 2019 07:08
Show Gist options
  • Select an option

  • Save mpugach/9093f092f63e5b91f08a8ac116684d66 to your computer and use it in GitHub Desktop.

Select an option

Save mpugach/9093f092f63e5b91f08a8ac116684d66 to your computer and use it in GitHub Desktop.

Revisions

  1. mpugach created this gist Feb 18, 2019.
    35 changes: 35 additions & 0 deletions application.ex
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    #https://gitlab.com/stressgrid/dummies/blob/master/elixir_dummy/lib/elixir_dummy/application.ex#L23
    defmodule Dummy.Application do
    @moduledoc false

    use Application

    def start(_type, _args) do
    dispatch =
    :cowboy_router.compile([
    {:_,
    [
    {"/", Dummy, %{}}
    ]}
    ])

    children = [
    %{
    id: :dummy,
    start:
    {:cowboy, :start_clear,
    [
    :dummy,
    %{max_connections: 999_999, socket_opts: [port: 5000]},
    %{max_keepalive: 1_000, env: %{dispatch: dispatch}}
    ]},
    restart: :permanent,
    shutdown: :infinity,
    type: :supervisor
    }
    ]

    opts = [strategy: :one_for_one, name: Dummy.Supervisor]
    Supervisor.start_link(children, opts)
    end
    end