Temp fix/hack for HTTP to work.

This commit is contained in:
Connor Rigby 2017-09-19 10:53:29 -07:00
parent 4d24f7a02b
commit beb136ea61
2 changed files with 9 additions and 5 deletions

View file

@ -283,7 +283,9 @@ defmodule Farmbot.HTTP do
|> add_header({"Content-Type", "application/json"})
opts = opts |> Keyword.put(:timeout, :infinity)
url = Farmbot.Jwt.decode!(tkn).iss <> url
#TODO Fix this.
url = "https:" <> Farmbot.Jwt.decode!(tkn).iss <> url
IO.inspect(url)
do_normal_request({method, url, body, headers, opts, from}, nil, state)
end

View file

@ -4,12 +4,14 @@ defmodule Farmbot.HTTP.Supervisor do
use Supervisor
@doc "Start HTTP services."
def start_link(args, opts \\ []) do
Supervisor.start_link(__MODULE__, args, opts)
def start_link(token, opts \\ []) do
Supervisor.start_link(__MODULE__, token, opts)
end
def init(_args) do
children = []
def init(token) do
children = [
worker(Farmbot.HTTP, [token, [name: Farmbot.HTTP]])
]
opts = [strategy: :one_for_all]
supervise(children, opts)
end