Last active
September 23, 2018 04:28
-
-
Save moxley/15bc2d2452f9e3a6872e5f1bed96275f to your computer and use it in GitHub Desktop.
hello module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Phoenix do | |
use Application | |
def start(_type, _args) do | |
_ = Phoenix.Template.engines() | |
_ = Phoenix.Template.format_encoder("index.html") | |
warn_on_missing_json_library() | |
if stacktrace_depth = Application.get_env(:phoenix, :stacktrace_depth) do | |
:erlang.system_flag(:backtrace_depth, stacktrace_depth) | |
end | |
import Supervisor.Spec | |
children = [ | |
worker(Phoenix.CodeReloader.Server, []), | |
supervisor(Phoenix.Transports.LongPoll.Supervisor, []) | |
] | |
Supervisor.start_link(children, strategy: :one_for_one, name: Phoenix.Supervisor) | |
end | |
def json_library do | |
Application.get_env(:phoenix, :json_library, Poison) | |
end | |
def plug_init_mode do | |
Application.get_env(:phoenix, :plug_init_mode, :compile) | |
end | |
defp warn_on_missing_json_library do | |
module = json_library() | |
Code.ensure_loaded?(module) || IO.warn """ | |
failed to load #{inspect(module)} for Phoenix JSON encoding | |
(module #{inspect(module)} is not available). | |
Ensure #{inspect(module)} is loaded from your deps in mix.exs, or | |
configure an existing encoder in your Mix config using: | |
config :phoenix, :json_library, MyJSONLibrary | |
""" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment