File tree Expand file tree Collapse file tree 2 files changed +7
-11
lines changed
Expand file tree Collapse file tree 2 files changed +7
-11
lines changed Original file line number Diff line number Diff line change 11defmodule CF.ReverseProxy.Plug do
22 @ moduledoc false
33
4+ require Logger
45 use Plug.Builder
56
67 plug (
@@ -36,6 +37,8 @@ defmodule CF.ReverseProxy.Plug do
3637 path_info -> [ path_info , CF.RestApi.Endpoint ]
3738 end
3839
40+ Logger . info ( "Redirecting #{ conn . host <> conn . request_path } to #{ endpoint } " )
41+
3942 conn
4043 |> Map . replace! ( :path_info , path_info )
4144 |> Map . replace! ( :request_path , Enum . join ( path_info , "/" ) )
@@ -44,8 +47,9 @@ defmodule CF.ReverseProxy.Plug do
4447 else
4548 # Prod requests are routed through here
4649 def call ( conn , _ ) do
47- subdomain = get_domain_from_host ( conn . host )
48- endpoint = Map . get ( @ subdomains , subdomain , @ default_host )
50+ service = get_domain_from_host ( conn . host )
51+ endpoint = Map . get ( @ subdomains , service , @ default_host )
52+ Logger . info ( "Redirecting #{ conn . host <> conn . request_path } to #{ endpoint } " )
4953 endpoint . call ( conn , endpoint . init ( nil ) )
5054 end
5155
Original file line number Diff line number Diff line change @@ -17,15 +17,7 @@ defmodule DB.Application do
1717 # See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
1818 # for other strategies and supported options
1919 opts = [ strategy: :one_for_one , name: DB.Supervisor ]
20- link = Supervisor . start_link ( children , opts )
21- migrate_db ( )
22- link
23- end
24-
25- defp migrate_db do
26- Logger . info ( "Running migrations..." )
27- Ecto.Migrator . run ( DB.Repo , migrations_path ( ) , :up , all: true )
28- Logger . info ( "Migrated!" )
20+ Supervisor . start_link ( children , opts )
2921 end
3022
3123 defp migrations_path do
You can’t perform that action at this time.
0 commit comments