Skip to content

Commit

Permalink
Merge pull request #26 from jw2013/pr/25
Browse files Browse the repository at this point in the history
Upgrade Phoenix to 0.7.2
  • Loading branch information
DefiPanda committed Jan 1, 2015
2 parents 9a4f484 + 037afe8 commit 0abb363
Show file tree
Hide file tree
Showing 43 changed files with 480 additions and 250 deletions.
32 changes: 13 additions & 19 deletions config/config.exs
Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@
# This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
#
# This configuration file is loaded before any dependency and
# is restricted to this project.
use Mix.Config

# Note this file is loaded before any dependency and is restricted
# to this project. If another project depends on this project, this
# file won't be loaded nor affect the parent project.

config :phoenix, ElixirChina.Router,
port: System.get_env("PORT"),
ssl: false,
static_assets: true,
cookies: true,
session_key: "_elixir_china_key",
session_secret: "Y7$OZ^TN9H**1EO3@VKKLSZ3VH)@SL)@VK6P@TI0(N8U_EOO+*XZKVM#G80VJRN4DURCW1IV&H",
catch_errors: true,
debug_errors: false,
error_controller: ElixirChina.PageController

config :phoenix, :code_reloader,
enabled: false
# Configures the endpoint
config :elixir_china, ElixirChina.Endpoint,
url: [host: "localhost"],
http: [port: System.get_env("PORT")],
secret_key_base: "ziHerwRAx1RS4ksABZzkL3Vl9aa1RH7b80BIv3v7Pn8l0ciAmfCjmuGKJxqoVoAL",
debug_errors: false

# Configures Elixir's Logger
config :logger, :console,
format: "$time $metadata[$level] $message\n",
metadata: [:request_id]

# Import environment specific config. Note, this must remain at the bottom of
# this file to properly merge your previous config entries.
# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
import_config "#{Mix.env}.exs"
16 changes: 4 additions & 12 deletions config/dev.exs
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
use Mix.Config

config :phoenix, ElixirChina.Router,
port: System.get_env("PORT") || 4000,
ssl: false,
host: "localhost",
cookies: true,
session_key: "_elixir_china_key",
session_secret: "Y7$OZ^TN9H**1EO3@VKKLSZ3VH)@SL)@VK6P@TI0(N8U_EOO+*XZKVM#G80VJRN4DURCW1IV&H",
config :elixir_china, ElixirChina.Endpoint,
http: [port: System.get_env("PORT") || 4000],
debug_errors: true

config :phoenix, :code_reloader,
enabled: true

config :logger, :console,
level: :debug
# Enables code reloading for development
config :phoenix, :code_reloader, true

config :elixir_china, :postgres,
host: "localhost",
Expand Down
30 changes: 14 additions & 16 deletions config/prod.exs
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
use Mix.Config

# NOTE: To get SSL working, you will need to set:
# ## SSL Support
#
# ssl: true,
# keyfile: System.get_env("SOME_APP_SSL_KEY_PATH"),
# certfile: System.get_env("SOME_APP_SSL_CERT_PATH"),
# To get SSL working, you will need to set:
#
# Where those two env variables point to a file on disk
# for the key and cert
# https: [port: 443,
# keyfile: System.get_env("SOME_APP_SSL_KEY_PATH"),
# certfile: System.get_env("SOME_APP_SSL_CERT_PATH")]
#
# Where those two env variables point to a file on
# disk for the key and cert.

config :phoenix, ElixirChina.Router,
port: System.get_env("PORT"),
ssl: false,
host: "example.com",
cookies: true,
session_key: "_elixir_china_key",
session_secret: System.get_env("SESSION_SECRET") || "Y7$OZ^TN9H**1EO3@VKKLSZ3VH)@SL)@VK6P@TI0(N8U_EOO+*XZKVM#G80VJRN4DURCW1IV&H"
config :elixir_china, ElixirChina.Endpoint,
url: [host: "example.com"],
http: [port: System.get_env("PORT")],
secret_key_base: "ziHerwRAx1RS4ksABZzkL3Vl9aa1RH7b80BIv3v7Pn8l0ciAmfCjmuGKJxqoVoAL"

config :logger, :console,
level: :info,
metadata: [:request_id]
config :logger,
level: :info

config :elixir_china, :postgres,
host: "localhost",
Expand Down
16 changes: 3 additions & 13 deletions config/test.exs
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
use Mix.Config

config :phoenix, ElixirChina.Router,
port: System.get_env("PORT") || 4001,
ssl: false,
cookies: true,
session_key: "_elixir_china_key",
session_secret: "Y7$OZ^TN9H**1EO3@VKKLSZ3VH)@SL)@VK6P@TI0(N8U_EOO+*XZKVM#G80VJRN4DURCW1IV&H"

config :phoenix, :code_reloader,
enabled: true

config :logger, :console,
level: :debug

config :elixir_china, ElixirChina.Endpoint,
http: [port: System.get_env("PORT") || 4001]

config :elixir_china, :postgres,
host: "localhost",
database: "elixir_china",
Expand Down
20 changes: 19 additions & 1 deletion lib/elixir_china.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,24 @@ defmodule ElixirChina do
# See http://elixir-lang.org/docs/stable/elixir/Application.html
# for more information on OTP Applications
def start(_type, _args) do
ElixirChina.Supervisor.start_link
import Supervisor.Spec, warn: false

children = [
# Define workers and child supervisors to be supervised
# worker(ElixirChina.Worker, [arg1, arg2, arg3])
worker(Repo, [])
]

# See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: ElixirChina.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
ElixirChina.Endpoint.config_change(changed, removed)
:ok
end
end
28 changes: 28 additions & 0 deletions lib/elixir_china/endpoint.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
defmodule ElixirChina.Endpoint do
use Phoenix.Endpoint, otp_app: :elixir_china

plug Plug.Static,
at: "/", from: :elixir_china

plug Plug.Logger

# Code reloading will only work if the :code_reloader key of
# the :phoenix application is set to true in your config file.
plug Phoenix.CodeReloader

plug Plug.Parsers,
parsers: [:urlencoded, :multipart, :json],
pass: ["*/*"],
json_decoder: Poison

plug Plug.MethodOverride
plug Plug.Head

plug Plug.Session,
store: :cookie,
key: "_elixir_china_key",
signing_salt: "B6MBbJXj",
encryption_salt: "ILCzuU6U"

plug :router, ElixirChina.Router
end
13 changes: 0 additions & 13 deletions lib/elixir_china/supervisor.ex

This file was deleted.

22 changes: 12 additions & 10 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,31 @@ defmodule ElixirChina.Mixfile do
use Mix.Project

def project do
[ app: :elixir_china,
version: "0.0.1",
elixir: "1.0.2",
elixirc_paths: ["lib", "web"],
deps: deps ]
[app: :elixir_china,
version: "0.0.1",
elixir: "~> 1.0",
elixirc_paths: ["lib", "web"],
compilers: [:phoenix] ++ Mix.compilers,
deps: deps]
end

# Configuration for the OTP application
#
# Type `mix help compile.app` for more information
def application do
[
mod: { ElixirChina, [] },
applications: [:phoenix, :cowboy, :logger, :postgrex, :ecto, :bcrypt]
]
end

# Returns the list of dependencies in the format:
# { :foobar, git: "https://github.com/elixir-lang/foobar.git", tag: "0.1" }
# Specifies your project dependencies
#
# To specify particular versions, regardless of the tag, do:
# { :barbat, "~> 0.1", github: "elixir-lang/barbat" }
# Type `mix help deps` for examples and options
defp deps do
[
{:phoenix, "0.4.1"},
{:phoenix, "0.7.2"},
{:linguist, "~> 0.1.4"},
{:cowboy, "~> 1.0.0"},
{:postgrex, ">= 0.0.0"},
{:ecto, "0.2.5"},
Expand Down
10 changes: 5 additions & 5 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
%{"bcrypt": {:git, "git://github.com/opscode/erlang-bcrypt.git", "7515e80a5e16f62aef149709f6cc09995dd480be", []},
"cowboy": {:hex, :cowboy, "1.0.0"},
"cowlib": {:hex, :cowlib, "1.0.0"},
"cowlib": {:hex, :cowlib, "1.0.1"},
"decimal": {:hex, :decimal, "0.2.5"},
"ecto": {:hex, :ecto, "0.2.5"},
"linguist": {:hex, :linguist, "0.1.2"},
"phoenix": {:hex, :phoenix, "0.4.1"},
"plug": {:hex, :plug, "0.7.0"},
"poison": {:hex, :poison, "1.1.1"},
"linguist": {:hex, :linguist, "0.1.4"},
"phoenix": {:hex, :phoenix, "0.7.2"},
"plug": {:hex, :plug, "0.9.0"},
"poison": {:hex, :poison, "1.3.0"},
"poolboy": {:hex, :poolboy, "1.2.1"},
"postgrex": {:hex, :postgrex, "0.6.0"},
"quickrand": {:git, "https://github.com/okeuday/quickrand.git", "0395a10b94472ccbe38b62bbfa9d0fc1ddac1dd7", [tag: "v1.3.2"]},
Expand Down
Loading

0 comments on commit 0abb363

Please sign in to comment.