Skip to content

Commit

Permalink
chore: Run mix format. #62
Browse files Browse the repository at this point in the history
  • Loading branch information
LuchoTurtle committed Jul 10, 2023
1 parent acb134c commit 41611e7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
1 change: 0 additions & 1 deletion lib/app_web/controllers/api_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ defmodule AppWeb.ApiController do
require Logger

def create(conn, %{"" => params}) do

# Check if content_type e.g: "image/png"
if String.contains?(params.content_type, "image") do
case App.Upload.upload(params) do
Expand Down
16 changes: 9 additions & 7 deletions lib/app_web/controllers/page_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,23 @@ defmodule AppWeb.PageController do
@env_required ~w/AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_REGION/

def home(conn, _params) do
init = if Envar.is_set_all?(@env_required) do
"All Set!"
else
"cannot be run until all required environment variables are set"
end
init =
if Envar.is_set_all?(@env_required) do
"All Set!"
else
"cannot be run until all required environment variables are set"
end

# The home page is often custom made,
# so skip the default app layout.
render(conn, :home, layout: false, env: check_env(@env_required), init: init)
end


defp check_env(keys) do
Enum.reduce(keys, %{}, fn key, acc ->
src = "https://raw.githubusercontent.com/dwyl/auth/main/assets/static/images/#{Envar.is_set?(key)}.png"
src =
"https://raw.githubusercontent.com/dwyl/auth/main/assets/static/images/#{Envar.is_set?(key)}.png"

Map.put(acc, key, src)
end)
end
Expand Down
20 changes: 10 additions & 10 deletions lib/app_web/controllers/page_html/home.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
<h1 class="">Initialization</h1>

<h2 class="">
<code>init</code>: <%= @init %> </h2>
<code>init</code>: <%= @init %>
</h2>

<table class="w-80 mw5 mw7-ns center">
<thead>
Expand All @@ -70,15 +71,14 @@
</tr>
</thead>
<tbody>

<%= for {key, val} <- @env do %>
<tr class="bb b--moon-gray">
<td class=""><pre class="mono bold"><%= key %></pre></td>
<td class="center pl4">
<img width="30px" src={"#{val}"}>
</td>
</tr>
<% end %>
<%= for {key, val} <- @env do %>
<tr class="bb b--moon-gray">
<td class=""><pre class="mono bold"><%= key %></pre></td>
<td class="center pl4">
<img width="30px" src={"#{val}"} />
</td>
</tr>
<% end %>
</tbody>
</table>
</div>

0 comments on commit 41611e7

Please sign in to comment.