Skip to content

Commit

Permalink
use new Phx 1.3 application file, #168
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonLab committed Feb 15, 2018
1 parent 29fb05f commit 830c6fb
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 37 deletions.
14 changes: 7 additions & 7 deletions config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ config :logger, :console, format: "[$level] $message\n"
config :phoenix, :stacktrace_depth, 20

# Configure your database
config :dwylbot, Dwylbot.Repo,
adapter: Ecto.Adapters.Postgres,
username: "postgres",
password: "postgres",
database: "dwylbot_dev",
hostname: "localhost",
pool_size: 10
# config :dwylbot, Dwylbot.Repo,
# adapter: Ecto.Adapters.Postgres,
# username: "postgres",
# password: "postgres",
# database: "dwylbot_dev",
# hostname: "localhost",
# pool_size: 10

config :dwylbot, :github_api, DwylbotWeb.GithubAPI.HTTPClient
49 changes: 23 additions & 26 deletions lib/dwylbot.ex
Original file line number Diff line number Diff line change
@@ -1,31 +1,28 @@
defmodule Dwylbot do
use Application

# See http://elixir-lang.org/docs/stable/elixir/Application.html
# for more information on OTP Applications
def start(_type, _args) do
import Supervisor.Spec

# Define workers and child supervisors to be supervised
children = [
# Start the Ecto repository
# supervisor(Dwylbot.Repo, []),
# Start the endpoint when the application starts
supervisor(DwylbotWeb.Endpoint, []),
# Start your own worker by calling: Dwylbot.Worker.start_link(arg1, arg2, arg3)
# worker(Dwylbot.Worker, [arg1, arg2, arg3]),
]

# See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: Dwylbot.Supervisor]
Supervisor.start_link(children, opts)
end
# use Application
#
# # See http://elixir-lang.org/docs/stable/elixir/Application.html
# # for more information on OTP Applications
# def start(_type, _args) do
# import Supervisor.Spec
#
# # Define workers and child supervisors to be supervised
# children = [
# # Start the Ecto repository
# # supervisor(Dwylbot.Repo, []),
# # Start the endpoint when the application starts
# supervisor(DwylbotWeb.Endpoint, [])
# # Start your own worker by calling: Dwylbot.Worker.start_link(arg1, arg2, arg3)
# # worker(Dwylbot.Worker, [arg1, arg2, arg3]),
# ]
#
# # See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
# # for other strategies and supported options
# opts = [strategy: :one_for_one, name: Dwylbot.Supervisor]
# Supervisor.start_link(children, opts)
# end

# Tell Phoenix to update the endpoint configuration
# whenever the application is updated.
def config_change(changed, _new, removed) do
DwylbotWeb.Endpoint.config_change(changed, removed)
:ok
end

end
31 changes: 31 additions & 0 deletions lib/dwylbot/application.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
defmodule Dwylbot.Application do
use Application

# See http://elixir-lang.org/docs/stable/elixir/Application.html
# for more information on OTP Applications
def start(_type, _args) do
import Supervisor.Spec

# Define workers and child supervisors to be supervised
children = [
# Start the Ecto repository
# supervisor(Dwylbot.Repo, []),
# Start the endpoint when the application starts
supervisor(DwylbotWeb.Endpoint, [])
# Start your own worker by calling: Dwylbot.Worker.start_link(arg1, arg2, arg3)
# worker(Dwylbot.Worker, [arg1, arg2, arg3]),
]

# See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: Dwylbot.Supervisor]
Supervisor.start_link(children, opts)
end

# Tell Phoenix to update the endpoint configuration
# whenever the application is updated.
def config_change(changed, _new, removed) do
DwylbotWeb.Endpoint.config_change(changed, removed)
:ok
end
end
3 changes: 0 additions & 3 deletions lib/dwylbot/repo.ex

This file was deleted.

2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ defmodule Dwylbot.Mixfile do
#
# Type `mix help compile.app` for more information.
def application do
[mod: {Dwylbot, []},
[mod: {Dwylbot.Application, []},
applications: [:phoenix, :phoenix_pubsub, :phoenix_html, :cowboy, :logger, :gettext,
:phoenix_ecto, :postgrex, :httpoison, :joken, :jose]]
end
Expand Down

0 comments on commit 830c6fb

Please sign in to comment.