View Source Tamnoon (Tamnoon v1.0.0-rc.3)
This module provides functions needed to initialize Tamnoon. You do not need to handle
it directly, rather, the only time you need to call something in this module is in your
supervision tree, to add it to the children and configure it (see child_spec/1).
Example
def start_link(opts \\ []) do
children = [Tamnoon]
opts = [strategy: :one_for_one, name: Tamnoon.Supervisor]
Supervisor.start_link(children, opts)
end
Summary
Types
Options for initializing Tamnoon.
Options for configuring the protocol used by Tamnoon. Can be either :http or a keyword list containing
values for :keyfile, :certfile, and :otp_app (:otp_app is required only when using relative paths for the
key and certificate files). Defaults to :http.
Functions
Returns a Tamnoon server supervisor child spec. See tamnoon_opts/0 for more info.
Copies HEEx file components to the release directory and creates a tamnoon_out directory
in it. It is used as a step in the release (see Mix.Release).
Starts the supervisor. See tamnoon_opts/0 for more info.
Types
@type tamnoon_opts() :: [ initial_state: (-> map()) | map(), port: number(), methods_modules: [module()], router: module(), debug_mode: :req | :state | :all | :none, live_reload: boolean(), socket_handler: module(), protocol_opts: tamnoon_protocol_opts() ]
Options for initializing Tamnoon.
port: The port Tamnoon will run on. Defaults to 8000.initial_state: A map, or a function that returns one, representing the state new clients will start with. Defaults to an empty map.methods_modules: A list of modules where your methods are defined (seeTamnoon.Methods). Defaults toTamnoon.Methods.router: The router module (seePlug.Router). Defaults toTamnoon.Router.debug_mode: Debug mode settings. If set to:reqor:state, it will log requests or the state respectively. If set to:allor:none, it will log both or none. Defaults to:none.live_reload: Whether to enable live reload. Defaults totrue. If set totrue, Tamnoon will automatically recompile when new connections are made (or when a client refreshes the page).protocol_opts: Whether Tamnoon uses HTTP or HTTPS. Seetamnoon_protocol_opts/0for more info.socket_handler: The handler module for WebSocket requests. Usually doesn't need to be overriden. Defaults toTamnoon.SocketHandler.
@type tamnoon_protocol_opts() :: :http | [keyfile: String.t(), certfile: String.t(), otp_app: atom()]
Options for configuring the protocol used by Tamnoon. Can be either :http or a keyword list containing
values for :keyfile, :certfile, and :otp_app (:otp_app is required only when using relative paths for the
key and certificate files). Defaults to :http.
Functions
@spec child_spec(opts :: tamnoon_opts()) :: map()
Returns a Tamnoon server supervisor child spec. See tamnoon_opts/0 for more info.
@spec make_release(Mix.Release) :: Mix.Release
Copies HEEx file components to the release directory and creates a tamnoon_out directory
in it. It is used as a step in the release (see Mix.Release).
@spec start_link(server_opts :: tamnoon_opts()) :: {:ok, pid()} | {:error, {:already_started, pid()} | {:shutdown, term()} | term()}
Starts the supervisor. See tamnoon_opts/0 for more info.