Skip to content

Commit

Permalink
Refactor Example App to use new configs
Browse files Browse the repository at this point in the history
  • Loading branch information
trenpixster committed Jul 19, 2016
1 parent f7dae62 commit ae86432
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 30 deletions.
32 changes: 6 additions & 26 deletions example_app/config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -30,35 +30,15 @@ config :phoenix, :generators,

config :addict,
secret_key: "2432622431322479506177654c79303442354a5a4b784f592e444f332e",
extra_validation: &ExampleApp.User.validate/2, # define extra validation here
extra_validation: {ExampleApp.User, :validate}, # define extra validation here
user_schema: ExampleApp.User,
repo: ExampleApp.Repo,
from_email: "[email protected]", # CHANGE THIS
mailgun_domain: "https://api.mailgun.net/v3/CHANGE-THIS",
mailgun_key: "key-CHANGE-THIS",
mail_service: :mailgun,
post_register: fn(conn, status, model) ->
IO.inspect status
IO.inspect model
conn
end,
post_login: fn(conn, status, model) ->
IO.inspect status
IO.inspect model
conn
end,
post_logout: fn(conn, status, model) ->
IO.inspect status
IO.inspect model
conn
end,
post_reset_password: fn(conn, status, model) ->
IO.inspect status
IO.inspect model
conn
end,
post_recover_password: fn(conn, status, model) ->
IO.inspect status
IO.inspect model
conn
end
post_register: {ExampleApp, :post_register_hook},
post_login: {ExampleApp, :post_login_hook},
post_logout: {ExampleApp, :post_logout_hook},
post_reset_password: {ExampleApp, :post_reset_password_hook},
post_recover_password: {ExampleApp, :post_recover_password_hook}
10 changes: 9 additions & 1 deletion example_app/config/prod.exs
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,12 @@ config :logger, level: :info

# Finally import the config/prod.secret.exs
# which should be versioned separately.
import_config "prod.secret.exs"
# import_config "prod.secret.exs"

config :example_app, ExampleApp.Repo,
adapter: Ecto.Adapters.Postgres,
username: "postgres",
password: "postgres",
database: "example_app_dev",
hostname: "localhost",
pool_size: 10
3 changes: 2 additions & 1 deletion example_app/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ defmodule ExampleApp.Mixfile do
def application do
[mod: {ExampleApp, []},
applications: [:phoenix, :phoenix_html, :cowboy, :logger, :gettext,
:phoenix_ecto, :postgrex, :phoenix_pubsub]]
:phoenix_ecto, :postgrex, :phoenix_pubsub, :addict]]
end

# Specifies which paths to compile per environment.
Expand All @@ -38,6 +38,7 @@ defmodule ExampleApp.Mixfile do
{:phoenix_live_reload, "~> 1.0", only: :dev},
{:gettext, "~> 0.9"},
{:cowboy, "~> 1.0"},
{:exrm, "~> 1.0"},
{:addict, path: "../"}]
end

Expand Down
11 changes: 9 additions & 2 deletions example_app/mix.lock
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
%{"comeonin": {:hex, :comeonin, "2.1.1", "6187c3764e98c3a963650f64cef067e01daed2f2de4177f666f60b50c14e9981", [:mix, :make, :make], []},
%{"bbmustache": {:hex, :bbmustache, "1.0.4", "7ba94f971c5afd7b6617918a4bb74705e36cab36eb84b19b6a1b7ee06427aa38", [:rebar], []},
"cf": {:hex, :cf, "0.2.1", "69d0b1349fd4d7d4dc55b7f407d29d7a840bf9a1ef5af529f1ebe0ce153fc2ab", [:rebar3], []},
"comeonin": {:hex, :comeonin, "2.1.1", "6187c3764e98c3a963650f64cef067e01daed2f2de4177f666f60b50c14e9981", [:mix, :make, :make], []},
"connection": {:hex, :connection, "1.0.3", "3145f7416be3df248a4935f24e3221dc467c1e3a158d62015b35bd54da365786", [:mix], []},
"cowboy": {:hex, :cowboy, "1.0.4", "a324a8df9f2316c833a470d918aaf73ae894278b8aa6226ce7a9bf699388f878", [:rebar, :make], [{:cowlib, "~> 1.0.0", [hex: :cowlib, optional: false]}, {:ranch, "~> 1.0", [hex: :ranch, optional: false]}]},
"cowlib": {:hex, :cowlib, "1.0.2", "9d769a1d062c9c3ac753096f868ca121e2730b9a377de23dec0f7e08b1df84ee", [:make], []},
"db_connection": {:hex, :db_connection, "1.0.0-rc.3", "d9ceb670fe300271140af46d357b669983cd16bc0d01206d7d3222dde56cf038", [:mix], [{:sbroker, "~> 1.0.0-beta.3", [hex: :sbroker, optional: true]}, {:poolboy, "~> 1.5", [hex: :poolboy, optional: true]}, {:connection, "~> 1.0.2", [hex: :connection, optional: false]}]},
"decimal": {:hex, :decimal, "1.1.2", "79a769d4657b2d537b51ef3c02d29ab7141d2b486b516c109642d453ee08e00c", [:mix], []},
"ecto": {:hex, :ecto, "2.0.2", "b02331c1f20bbe944dbd33c8ecd8f1ccffecc02e344c4471a891baf3a25f5406", [:mix], [{:poison, "~> 1.5 or ~> 2.0", [hex: :poison, optional: true]}, {:sbroker, "~> 1.0-beta", [hex: :sbroker, optional: true]}, {:mariaex, "~> 0.7.7", [hex: :mariaex, optional: true]}, {:postgrex, "~> 0.11.2", [hex: :postgrex, optional: true]}, {:db_connection, "~> 1.0-rc.2", [hex: :db_connection, optional: true]}, {:decimal, "~> 1.0", [hex: :decimal, optional: false]}, {:poolboy, "~> 1.5", [hex: :poolboy, optional: false]}]},
"erlware_commons": {:hex, :erlware_commons, "0.21.0", "a04433071ad7d112edefc75ac77719dd3e6753e697ac09428fc83d7564b80b15", [:rebar3], [{:cf, "0.2.1", [hex: :cf, optional: false]}]},
"exrm": {:hex, :exrm, "1.0.8", "5aa8990cdfe300282828b02cefdc339e235f7916388ce99f9a1f926a9271a45d", [:mix], [{:relx, "~> 3.5", [hex: :relx, optional: false]}]},
"fs": {:hex, :fs, "0.9.2", "ed17036c26c3f70ac49781ed9220a50c36775c6ca2cf8182d123b6566e49ec59", [:rebar], []},
"getopt": {:hex, :getopt, "0.8.2", "b17556db683000ba50370b16c0619df1337e7af7ecbf7d64fbf8d1d6bce3109b", [:rebar], []},
"gettext": {:hex, :gettext, "0.10.0", "b6f9a72be494ad84ccbfaf7349150ef319b9a5a2b634e4d3ccf70bd59e1e4178", [:mix], []},
"mailgun": {:hex, :mailgun, "0.1.2", "37c1306675cf27a66a13dea3c9d479da2a990f0aed296b5addbd0b07529b667d", [:mix], [{:poison, "~> 1.4", [hex: :poison, optional: false]}]},
"phoenix": {:hex, :phoenix, "1.2.0", "1bdeb99c254f4c534cdf98fd201dede682297ccc62fcac5d57a2627c3b6681fb", [:mix], [{:poison, "~> 1.5 or ~> 2.0", [hex: :poison, optional: false]}, {:phoenix_pubsub, "~> 1.0", [hex: :phoenix_pubsub, optional: false]}, {:plug, "~> 1.1", [hex: :plug, optional: false]}, {:cowboy, "~> 1.0", [hex: :cowboy, optional: true]}]},
Expand All @@ -17,4 +22,6 @@
"poison": {:hex, :poison, "1.5.2", "560bdfb7449e3ddd23a096929fb9fc2122f709bcc758b2d5d5a5c7d0ea848910", [:mix], []},
"poolboy": {:hex, :poolboy, "1.5.1", "6b46163901cfd0a1b43d692657ed9d7e599853b3b21b95ae5ae0a777cf9b6ca8", [:rebar], []},
"postgrex": {:hex, :postgrex, "0.11.2", "139755c1359d3c5c6d6e8b1ea72556d39e2746f61c6ddfb442813c91f53487e8", [:mix], [{:connection, "~> 1.0", [hex: :connection, optional: false]}, {:db_connection, "~> 1.0-rc", [hex: :db_connection, optional: false]}, {:decimal, "~> 1.0", [hex: :decimal, optional: false]}]},
"ranch": {:hex, :ranch, "1.2.1", "a6fb992c10f2187b46ffd17ce398ddf8a54f691b81768f9ef5f461ea7e28c762", [:make], []}}
"providers": {:hex, :providers, "1.6.0", "db0e2f9043ae60c0155205fcd238d68516331d0e5146155e33d1e79dc452964a", [:rebar3], [{:getopt, "0.8.2", [hex: :getopt, optional: false]}]},
"ranch": {:hex, :ranch, "1.2.1", "a6fb992c10f2187b46ffd17ce398ddf8a54f691b81768f9ef5f461ea7e28c762", [:make], []},
"relx": {:hex, :relx, "3.20.0", "b515b8317d25b3a1508699294c3d1fa6dc0527851dffc87446661bce21a36710", [:rebar3], [{:providers, "1.6.0", [hex: :providers, optional: false]}, {:getopt, "0.8.2", [hex: :getopt, optional: false]}, {:erlware_commons, "0.21.0", [hex: :erlware_commons, optional: false]}, {:cf, "0.2.1", [hex: :cf, optional: false]}, {:bbmustache, "1.0.4", [hex: :bbmustache, optional: false]}]}}

0 comments on commit ae86432

Please sign in to comment.