mirror of
https://github.com/mgerb/classic-wow-forums
synced 2026-01-11 17:42:48 +00:00
load config from server instead of config file
This commit is contained in:
15
lib/myapp_web/controllers/config_controller.ex
Normal file
15
lib/myapp_web/controllers/config_controller.ex
Normal file
@@ -0,0 +1,15 @@
|
||||
defmodule MyAppWeb.ConfigController do
|
||||
use MyAppWeb, :controller
|
||||
alias MyAppWeb.Response
|
||||
alias MyApp.Data
|
||||
|
||||
def get_config(conn, _params) do
|
||||
output = %{
|
||||
"client_id": Application.get_env(:myapp, :bnet_client_id),
|
||||
"redirect_uri": Application.get_env(:myapp, :bnet_redirect_uri),
|
||||
}
|
||||
conn
|
||||
|> put_status(200)
|
||||
|> Response.json(output)
|
||||
end
|
||||
end
|
||||
@@ -22,6 +22,8 @@ defmodule MyAppWeb.Router do
|
||||
scope "/api", MyAppWeb do
|
||||
pipe_through [:api]
|
||||
|
||||
get "/config", ConfigController, :get_config
|
||||
|
||||
scope "/user" do
|
||||
post "/authorize", UserController, :authorize
|
||||
post "/login", UserController, :login
|
||||
|
||||
Reference in New Issue
Block a user