mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
Merge pull request #14 from CloudFire-LLC/add-css-framework
Add css framework
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
/* This file is for your main application css. */
|
||||
|
||||
@import "./phoenix.css";
|
||||
@import "./main.css";
|
||||
|
||||
0
apps/cf_http/assets/css/main.css
Normal file
0
apps/cf_http/assets/css/main.css
Normal file
File diff suppressed because one or more lines are too long
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="100pt" height="100pt" version="1.1" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
|
||||
<g fill-rule="evenodd">
|
||||
<path d="m34.305 41.426c-3.8828-0.97266-21.035-6.1484-34.305-11.652-0.32422 0.32422 1.9414 6.7969 10.355 9.707 5.8242 1.6172 18.77 4.5312 24.594 5.8242-4.207-0.32422-18.121-2.2656-33.332-5.5-0.32422 0.32422 2.2656 6.1484 10.355 7.4453 5.1797 0.64844 17.152 1.6172 23.301 1.9414-3.2344 0.32422-16.504 0.97266-26.215 0.32422 0 0.32422 3.8828 4.8555 9.707 4.5312 4.8555 0 16.828-0.97266 21.359-1.293-2.9141 0.64844-17.801 3.5586-25.566 4.207 0 0.32422 3.5586 3.2344 8.0898 2.5898 3.8828-0.64844 15.859-3.5586 19.094-4.5312-2.2656 1.293-11.973 4.207-20.387 6.4727 0 0.32422 3.5586 2.5898 7.4453 1.293 2.9141-0.97266 9.707-3.5586 13.27-4.8555-2.2656 1.293-3.5586 2.2656-11.004 5.5 3.8828 6.7969 9.3867 13.594 19.094 18.121 9.3867-4.5312 15.211-11.328 18.77-18.121-7.4453-3.2344-8.7383-4.207-11.004-5.5 3.5586 1.293 10.355 3.8828 13.27 4.8555 4.207 1.293 7.4453-0.97266 7.4453-1.293-8.0898-2.2656-18.121-5.1797-20.387-6.4727 3.5586 0.97266 15.211 3.8828 19.418 4.5312 4.5312 0.64844 7.7656-2.2656 7.7656-2.5898-7.4453-0.64844-22.652-3.5586-25.242-4.207 4.207 0.32422 16.18 1.293 21.035 1.293 5.8242 0.32422 9.707-4.207 9.707-4.5312-9.707 0.64844-22.977 0-26.215-0.32422 6.1484-0.32422 18.121-1.293 23.301-1.9414 8.0898-1.293 10.68-7.1211 10.68-7.4453-15.211 3.2344-29.449 5.1797-33.656 5.5 5.8242-1.293 19.094-4.207 24.594-5.8242 8.4141-2.9141 10.68-9.3867 10.355-9.707-13.27 5.5-30.098 10.68-34.305 11.652 6.7969-2.9141 22.977-10.355 27.184-13.27 4.8555-3.5586 6.4727-9.707 5.8242-9.707-16.504 10.031-33.98 16.828-38.836 19.742-5.1797 2.9141-1.293 6.1484-1.6172 8.4141-0.97266 3.5586-5.1797 5.8242-8.0898 7.1211-2.9141-1.293-7.4453-3.5586-8.0898-7.1211-0.64844-2.2656 3.2344-5.5-1.9414-8.4141-4.8555-2.9141-22.008-9.707-38.836-19.742-0.64844 0 0.97266 6.1484 5.8242 9.707 4.207 2.9141 20.387 10.355 27.184 13.27z"/>
|
||||
<path d="m24.273 26.215h51.781v3.5586c-7.4453 1.9414-16.504 3.2344-25.891 3.2344-9.707 0-18.77-1.293-25.891-3.2344z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 2.1 KiB |
@@ -12,7 +12,7 @@ defmodule CfHttp.Devices.Device do
|
||||
field :verified_at, :utc_datetime
|
||||
field :user_id, :id
|
||||
|
||||
has_many :firewall_rules, CfHttp.FirewallRules.FirewallRule
|
||||
has_many :rules, CfHttp.Rules.Rule
|
||||
|
||||
timestamps()
|
||||
end
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
defmodule CfHttp.FirewallRules do
|
||||
@moduledoc """
|
||||
The FirewallRules context.
|
||||
"""
|
||||
|
||||
import Ecto.Query, warn: false
|
||||
alias CfHttp.Repo
|
||||
|
||||
alias CfHttp.FirewallRules.FirewallRule
|
||||
|
||||
@doc """
|
||||
Returns the list of firewall_rules.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> list_firewall_rules()
|
||||
[%FirewallRule{}, ...]
|
||||
|
||||
"""
|
||||
def list_firewall_rules do
|
||||
Repo.all(FirewallRule)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Gets a single firewall_rule.
|
||||
|
||||
Raises `Ecto.NoResultsError` if the Firewall rule does not exist.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> get_firewall_rule!(123)
|
||||
%FirewallRule{}
|
||||
|
||||
iex> get_firewall_rule!(456)
|
||||
** (Ecto.NoResultsError)
|
||||
|
||||
"""
|
||||
def get_firewall_rule!(id), do: Repo.get!(FirewallRule, id)
|
||||
|
||||
@doc """
|
||||
Creates a firewall_rule.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> create_firewall_rule(%{field: value})
|
||||
{:ok, %FirewallRule{}}
|
||||
|
||||
iex> create_firewall_rule(%{field: bad_value})
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def create_firewall_rule(attrs \\ %{}) do
|
||||
%FirewallRule{}
|
||||
|> FirewallRule.changeset(attrs)
|
||||
|> Repo.insert()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Updates a firewall_rule.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> update_firewall_rule(firewall_rule, %{field: new_value})
|
||||
{:ok, %FirewallRule{}}
|
||||
|
||||
iex> update_firewall_rule(firewall_rule, %{field: bad_value})
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def update_firewall_rule(%FirewallRule{} = firewall_rule, attrs) do
|
||||
firewall_rule
|
||||
|> FirewallRule.changeset(attrs)
|
||||
|> Repo.update()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Deletes a firewall_rule.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> delete_firewall_rule(firewall_rule)
|
||||
{:ok, %FirewallRule{}}
|
||||
|
||||
iex> delete_firewall_rule(firewall_rule)
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def delete_firewall_rule(%FirewallRule{} = firewall_rule) do
|
||||
Repo.delete(firewall_rule)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Returns an `%Ecto.Changeset{}` for tracking firewall_rule changes.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> change_firewall_rule(firewall_rule)
|
||||
%Ecto.Changeset{source: %FirewallRule{}}
|
||||
|
||||
"""
|
||||
def change_firewall_rule(%FirewallRule{} = firewall_rule) do
|
||||
FirewallRule.changeset(firewall_rule, %{})
|
||||
end
|
||||
end
|
||||
104
apps/cf_http/lib/cf_http/rules.ex
Normal file
104
apps/cf_http/lib/cf_http/rules.ex
Normal file
@@ -0,0 +1,104 @@
|
||||
defmodule CfHttp.Rules do
|
||||
@moduledoc """
|
||||
The Rules context.
|
||||
"""
|
||||
|
||||
import Ecto.Query, warn: false
|
||||
alias CfHttp.Repo
|
||||
|
||||
alias CfHttp.Rules.Rule
|
||||
|
||||
@doc """
|
||||
Returns the list of rules.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> list_rules()
|
||||
[%Rule{}, ...]
|
||||
|
||||
"""
|
||||
def list_rules do
|
||||
Repo.all(Rule)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Gets a single rule.
|
||||
|
||||
Raises `Ecto.NoResultsError` if the Rule does not exist.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> get_rule!(123)
|
||||
%Rule{}
|
||||
|
||||
iex> get_rule!(456)
|
||||
** (Ecto.NoResultsError)
|
||||
|
||||
"""
|
||||
def get_rule!(id), do: Repo.get!(Rule, id)
|
||||
|
||||
@doc """
|
||||
Creates a rule.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> create_rule(%{field: value})
|
||||
{:ok, %Rule{}}
|
||||
|
||||
iex> create_rule(%{field: bad_value})
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def create_rule(attrs \\ %{}) do
|
||||
%Rule{}
|
||||
|> Rule.changeset(attrs)
|
||||
|> Repo.insert()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Updates a rule.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> update_rule(rule, %{field: new_value})
|
||||
{:ok, %Rule{}}
|
||||
|
||||
iex> update_rule(rule, %{field: bad_value})
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def update_rule(%Rule{} = rule, attrs) do
|
||||
rule
|
||||
|> Rule.changeset(attrs)
|
||||
|> Repo.update()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Deletes a rule.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> delete_rule(rule)
|
||||
{:ok, %Rule{}}
|
||||
|
||||
iex> delete_rule(rule)
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def delete_rule(%Rule{} = rule) do
|
||||
Repo.delete(rule)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Returns an `%Ecto.Changeset{}` for tracking rule changes.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> change_rule(rule)
|
||||
%Ecto.Changeset{source: %Rule{}}
|
||||
|
||||
"""
|
||||
def change_rule(%Rule{} = rule) do
|
||||
Rule.changeset(rule, %{})
|
||||
end
|
||||
end
|
||||
@@ -1,4 +1,4 @@
|
||||
defmodule CfHttp.FirewallRules.FirewallRule do
|
||||
defmodule CfHttp.Rules.Rule do
|
||||
@moduledoc """
|
||||
Not really sure what to write here. I'll update this later.
|
||||
"""
|
||||
@@ -6,7 +6,7 @@ defmodule CfHttp.FirewallRules.FirewallRule do
|
||||
use Ecto.Schema
|
||||
import Ecto.Changeset
|
||||
|
||||
schema "firewall_rules" do
|
||||
schema "rules" do
|
||||
field :destination, :string
|
||||
field :enabled, :boolean, default: false
|
||||
field :port, :string
|
||||
@@ -18,8 +18,8 @@ defmodule CfHttp.FirewallRules.FirewallRule do
|
||||
end
|
||||
|
||||
@doc false
|
||||
def changeset(firewall_rule, attrs) do
|
||||
firewall_rule
|
||||
def changeset(rule, attrs) do
|
||||
rule
|
||||
|> cast(attrs, [:destination, :port, :protocol, :enabled])
|
||||
|> validate_required([:destination, :port, :protocol, :enabled])
|
||||
end
|
||||
105
apps/cf_http/lib/cf_http/sessions.ex
Normal file
105
apps/cf_http/lib/cf_http/sessions.ex
Normal file
@@ -0,0 +1,105 @@
|
||||
defmodule CfHttp.Sessions do
|
||||
@moduledoc """
|
||||
The Sessions context.
|
||||
"""
|
||||
|
||||
import Ecto.Query, warn: false
|
||||
alias CfHttp.Repo
|
||||
|
||||
alias CfHttp.Sessions.Session
|
||||
|
||||
@doc """
|
||||
Returns the list of sessions.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> list_sessions()
|
||||
[%Session{}, ...]
|
||||
|
||||
"""
|
||||
def list_sessions do
|
||||
Repo.all(Session)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Gets a single session.
|
||||
|
||||
Raises `Ecto.NoResultsError` if the Session does not exist.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> get_session!(123)
|
||||
%Session{}
|
||||
|
||||
iex> get_session!(456)
|
||||
** (Ecto.NoResultsError)
|
||||
|
||||
"""
|
||||
def get_session!(id), do: Repo.get!(Session, id)
|
||||
|
||||
@doc """
|
||||
Creates a session.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> create_session(%{field: value})
|
||||
{:ok, %Session{}}
|
||||
|
||||
iex> create_session(%{field: bad_value})
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def create_session(attrs \\ %{}) do
|
||||
%Session{}
|
||||
|> Session.changeset(attrs)
|
||||
|> Repo.insert()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Updates a session.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> update_session(session, %{field: new_value})
|
||||
{:ok, %Session{}}
|
||||
|
||||
iex> update_session(session, %{field: bad_value})
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def update_session(%Session{} = session, attrs) do
|
||||
session
|
||||
|> Session.changeset(attrs)
|
||||
|> Repo.update()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Deletes a session.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> delete_session(session)
|
||||
{:ok, %Session{}}
|
||||
|
||||
iex> delete_session(session)
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def delete_session(%Session{} = session) do
|
||||
Repo.delete(session)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Returns an `%Ecto.Changeset{}` for tracking session changes.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> change_session(session)
|
||||
%Ecto.Changeset{source: %Session{}}
|
||||
|
||||
"""
|
||||
def change_session(%Session{} = session) do
|
||||
Session.changeset(session, %{})
|
||||
end
|
||||
end
|
||||
|
||||
21
apps/cf_http/lib/cf_http/sessions/session.ex
Normal file
21
apps/cf_http/lib/cf_http/sessions/session.ex
Normal file
@@ -0,0 +1,21 @@
|
||||
defmodule CfHttp.Sessions.Session do
|
||||
@moduledoc """
|
||||
Represents a Session
|
||||
"""
|
||||
|
||||
use Ecto.Schema
|
||||
import Ecto.Changeset
|
||||
|
||||
schema "sessions" do
|
||||
field :user_id, :id
|
||||
|
||||
timestamps()
|
||||
end
|
||||
|
||||
@doc false
|
||||
def changeset(session, attrs \\ %{}) do
|
||||
session
|
||||
|> cast(attrs, [])
|
||||
|> validate_required([])
|
||||
end
|
||||
end
|
||||
106
apps/cf_http/lib/cf_http/users.ex
Normal file
106
apps/cf_http/lib/cf_http/users.ex
Normal file
@@ -0,0 +1,106 @@
|
||||
defmodule CfHttp.Users do
|
||||
@moduledoc """
|
||||
The Users context.
|
||||
"""
|
||||
|
||||
import Ecto.Query, warn: false
|
||||
alias CfHttp.Repo
|
||||
|
||||
alias CfHttp.Users.User
|
||||
|
||||
@doc """
|
||||
Returns the list of users.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> list_users()
|
||||
[%User{}, ...]
|
||||
|
||||
"""
|
||||
def list_users do
|
||||
Repo.all(User)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Gets a single user.
|
||||
|
||||
Raises `Ecto.NoResultsError` if the User does not exist.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> get_user!(123)
|
||||
%User{}
|
||||
|
||||
iex> get_user!(456)
|
||||
** (Ecto.NoResultsError)
|
||||
|
||||
"""
|
||||
def get_user!(id), do: Repo.get!(User, id)
|
||||
|
||||
@doc """
|
||||
Creates a user.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> create_user(%{field: value})
|
||||
{:ok, %User{}}
|
||||
|
||||
iex> create_user(%{field: bad_value})
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def create_user(attrs \\ %{}) do
|
||||
%User{}
|
||||
|> User.changeset(attrs)
|
||||
|> Repo.insert()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Updates a user.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> update_user(user, %{field: new_value})
|
||||
{:ok, %User{}}
|
||||
|
||||
iex> update_user(user, %{field: bad_value})
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def update_user(%User{} = user, attrs) do
|
||||
user
|
||||
|> User.changeset(attrs)
|
||||
|> Repo.update()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Deletes a user.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> delete_user(user)
|
||||
{:ok, %User{}}
|
||||
|
||||
iex> delete_user(user)
|
||||
{:error, %Ecto.Changeset{}}
|
||||
|
||||
"""
|
||||
def delete_user(%User{} = user) do
|
||||
Repo.delete(user)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Returns an `%Ecto.Changeset{}` for tracking user changes.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> change_user(user)
|
||||
%Ecto.Changeset{source: %User{}}
|
||||
|
||||
"""
|
||||
def change_user(%User{} = user) do
|
||||
User.changeset(user, %{})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
defmodule CfHttp.User do
|
||||
defmodule CfHttp.Users.User do
|
||||
@moduledoc """
|
||||
Represents a User I guess
|
||||
"""
|
||||
@@ -1,8 +1,10 @@
|
||||
defmodule CfHttpWeb.DeviceController do
|
||||
use CfHttpWeb, :controller
|
||||
@moduledoc """
|
||||
Implements the CRUD for a Device
|
||||
"""
|
||||
|
||||
alias CfHttp.Devices
|
||||
alias CfHttp.Devices.Device
|
||||
use CfHttpWeb, :controller
|
||||
alias CfHttp.{Devices, Devices.Device}
|
||||
|
||||
plug CfHttpWeb.Plugs.Authenticator
|
||||
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
defmodule CfHttpWeb.FirewallRuleController do
|
||||
@moduledoc """
|
||||
Controller logic for FirewallRules
|
||||
"""
|
||||
|
||||
use CfHttpWeb, :controller
|
||||
|
||||
alias CfHttp.Devices
|
||||
alias CfHttp.FirewallRules
|
||||
alias CfHttp.FirewallRules.FirewallRule
|
||||
|
||||
plug CfHttpWeb.Plugs.Authenticator
|
||||
|
||||
def index(conn, %{"device_id" => device_id}) do
|
||||
device = Devices.get_device!(device_id)
|
||||
|
||||
render(conn, "index.html", device: device, firewall_rules: device.firewall_rules)
|
||||
end
|
||||
|
||||
def new(conn, %{"device_id" => device_id}) do
|
||||
device = Devices.get_device!(device_id)
|
||||
|
||||
changeset = FirewallRules.change_firewall_rule(%FirewallRule{device_id: device_id})
|
||||
render(conn, "new.html", changeset: changeset, device: device)
|
||||
end
|
||||
|
||||
def create(conn, %{"firewall_rule" => firewall_rule_params}) do
|
||||
case FirewallRules.create_firewall_rule(firewall_rule_params) do
|
||||
{:ok, firewall_rule} ->
|
||||
conn
|
||||
|> put_flash(:info, "Firewall rule created successfully.")
|
||||
|> redirect(to: Routes.firewall_rule_path(conn, :show, firewall_rule))
|
||||
|
||||
{:error, %Ecto.Changeset{} = changeset} ->
|
||||
render(conn, "new.html", changeset: changeset)
|
||||
end
|
||||
end
|
||||
|
||||
def show(conn, %{"id" => id}) do
|
||||
firewall_rule = FirewallRules.get_firewall_rule!(id)
|
||||
render(conn, "show.html", firewall_rule: firewall_rule)
|
||||
end
|
||||
|
||||
def edit(conn, %{"id" => id}) do
|
||||
firewall_rule = FirewallRules.get_firewall_rule!(id)
|
||||
changeset = FirewallRules.change_firewall_rule(firewall_rule)
|
||||
render(conn, "edit.html", firewall_rule: firewall_rule, changeset: changeset)
|
||||
end
|
||||
|
||||
def update(conn, %{"id" => id, "firewall_rule" => firewall_rule_params}) do
|
||||
firewall_rule = FirewallRules.get_firewall_rule!(id)
|
||||
|
||||
case FirewallRules.update_firewall_rule(firewall_rule, firewall_rule_params) do
|
||||
{:ok, firewall_rule} ->
|
||||
conn
|
||||
|> put_flash(:info, "Firewall rule updated successfully.")
|
||||
|> redirect(to: Routes.firewall_rule_path(conn, :show, firewall_rule))
|
||||
|
||||
{:error, %Ecto.Changeset{} = changeset} ->
|
||||
render(conn, "edit.html", firewall_rule: firewall_rule, changeset: changeset)
|
||||
end
|
||||
end
|
||||
|
||||
def delete(conn, %{"id" => id}) do
|
||||
firewall_rule = FirewallRules.get_firewall_rule!(id)
|
||||
{:ok, _firewall_rule} = FirewallRules.delete_firewall_rule(firewall_rule)
|
||||
|
||||
conn
|
||||
|> put_flash(:info, "Firewall rule deleted successfully.")
|
||||
|> redirect(to: Routes.firewall_rule_path(conn, :index, firewall_rule.device))
|
||||
end
|
||||
end
|
||||
@@ -1,7 +0,0 @@
|
||||
defmodule CfHttpWeb.PageController do
|
||||
use CfHttpWeb, :controller
|
||||
|
||||
def index(conn, _params) do
|
||||
render(conn, "index.html")
|
||||
end
|
||||
end
|
||||
70
apps/cf_http/lib/cf_http_web/controllers/rule_controller.ex
Normal file
70
apps/cf_http/lib/cf_http_web/controllers/rule_controller.ex
Normal file
@@ -0,0 +1,70 @@
|
||||
defmodule CfHttpWeb.RuleController do
|
||||
@moduledoc """
|
||||
Controller logic for Rules
|
||||
"""
|
||||
|
||||
use CfHttpWeb, :controller
|
||||
alias CfHttp.{Devices, Rules, Rules.Rule}
|
||||
|
||||
plug CfHttpWeb.Plugs.Authenticator
|
||||
|
||||
def index(conn, %{"device_id" => device_id}) do
|
||||
device = Devices.get_device!(device_id)
|
||||
|
||||
render(conn, "index.html", device: device, rules: device.rules)
|
||||
end
|
||||
|
||||
def new(conn, %{"device_id" => device_id}) do
|
||||
device = Devices.get_device!(device_id)
|
||||
|
||||
changeset = Rules.change_rule(%Rule{device_id: device_id})
|
||||
render(conn, "new.html", changeset: changeset, device: device)
|
||||
end
|
||||
|
||||
def create(conn, %{"rule" => rule_params}) do
|
||||
case Rules.create_rule(rule_params) do
|
||||
{:ok, rule} ->
|
||||
conn
|
||||
|> put_flash(:info, "Rule created successfully.")
|
||||
|> redirect(to: Routes.rule_path(conn, :show, rule))
|
||||
|
||||
{:error, %Ecto.Changeset{} = changeset} ->
|
||||
render(conn, "new.html", changeset: changeset)
|
||||
end
|
||||
end
|
||||
|
||||
def show(conn, %{"id" => id}) do
|
||||
rule = Rules.get_rule!(id)
|
||||
render(conn, "show.html", rule: rule)
|
||||
end
|
||||
|
||||
def edit(conn, %{"id" => id}) do
|
||||
rule = Rules.get_rule!(id)
|
||||
changeset = Rules.change_rule(rule)
|
||||
|
||||
render(conn, "edit.html", rule: rule, changeset: changeset)
|
||||
end
|
||||
|
||||
def update(conn, %{"id" => id, "rule" => rule_params}) do
|
||||
rule = Rules.get_rule!(id)
|
||||
|
||||
case Rules.update_rule(rule, rule_params) do
|
||||
{:ok, rule} ->
|
||||
conn
|
||||
|> put_flash(:info, "Rule updated successfully.")
|
||||
|> redirect(to: Routes.rule_path(conn, :show, rule))
|
||||
|
||||
{:error, %Ecto.Changeset{} = changeset} ->
|
||||
render(conn, "edit.html", rule: rule, changeset: changeset)
|
||||
end
|
||||
end
|
||||
|
||||
def delete(conn, %{"id" => id}) do
|
||||
rule = Rules.get_rule!(id)
|
||||
{:ok, _rule} = Rules.delete_rule(rule)
|
||||
|
||||
conn
|
||||
|> put_flash(:info, "Rule deleted successfully.")
|
||||
|> redirect(to: Routes.rule_path(conn, :index, rule.device))
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,59 @@
|
||||
defmodule CfHttpWeb.SessionController do
|
||||
@moduledoc """
|
||||
Implements the CRUD for a Session
|
||||
"""
|
||||
|
||||
use CfHttpWeb, :controller
|
||||
alias CfHttp.{Repo, Users.User, Sessions, Sessions.Session}
|
||||
|
||||
plug :redirect_authenticated when action in [:new]
|
||||
plug CfHttpWeb.Plugs.Authenticator when action in [:delete]
|
||||
|
||||
# GET /sessions/new
|
||||
def new(conn, _params) do
|
||||
changeset = Session.changeset(%Session{})
|
||||
|
||||
render(conn, "new.html", changeset: changeset)
|
||||
end
|
||||
|
||||
# Sign In
|
||||
# POST /sessions
|
||||
def create(conn, params) do
|
||||
changeset = Session.changeset(%Session{}, params)
|
||||
|
||||
case Repo.insert(changeset) do
|
||||
{:ok, session} ->
|
||||
conn
|
||||
|> assign(:current_session, session)
|
||||
|> put_flash(:info, "Session created successfully")
|
||||
|> redirect(to: Routes.device_path(conn, :index))
|
||||
|
||||
{:error, changeset} ->
|
||||
conn
|
||||
|> put_flash(:error, "Error creating session.")
|
||||
|> render("new.html", changeset: changeset)
|
||||
end
|
||||
end
|
||||
|
||||
# Sign Out
|
||||
# DELETE /session
|
||||
def delete(conn, _params) do
|
||||
case Repo.delete(conn.current_session) do
|
||||
{:ok, _session} ->
|
||||
conn
|
||||
|> assign(:current_session, nil)
|
||||
|> put_flash(:info, "Session deleted successfully.")
|
||||
|> redirect(to: "/")
|
||||
end
|
||||
end
|
||||
|
||||
defp redirect_authenticated(conn, _) do
|
||||
user = %User{id: 1, email: "dev_user@fireguard.network"}
|
||||
session = %Session{user_id: user.id}
|
||||
|
||||
conn
|
||||
|> assign(:current_session, session)
|
||||
|> redirect(to: "/")
|
||||
|> halt()
|
||||
end
|
||||
end
|
||||
@@ -4,30 +4,26 @@ defmodule CfHttpWeb.UserController do
|
||||
"""
|
||||
|
||||
use CfHttpWeb, :controller
|
||||
alias CfHttp.{Repo, User}
|
||||
alias CfHttp.{Repo, Users, Users.User}
|
||||
|
||||
plug CfHttpWeb.Plugs.Authenticator when action in [:show, :edit, :update, :delete]
|
||||
|
||||
# GET /users/new
|
||||
def new(conn, _params) do
|
||||
changeset = User.changeset(%User{})
|
||||
|
||||
conn
|
||||
|> render("new.html", changeset: changeset)
|
||||
changeset = Users.change_user(%User{})
|
||||
render(conn, "new.html", changeset: changeset)
|
||||
end
|
||||
|
||||
# POST /users
|
||||
def create(conn, params) do
|
||||
changeset = User.changeset(%User{}, params)
|
||||
|
||||
case Repo.insert(changeset) do
|
||||
def create(conn, %{"user" => user_params}) do
|
||||
case Users.create_user(conn, user_params) do
|
||||
{:ok, user} ->
|
||||
conn
|
||||
|> assign(:current_user, user)
|
||||
|> put_flash(:info, "User created successfully")
|
||||
|> put_flash(:info, "User created successfully.")
|
||||
|> redirect(to: Routes.device_path(conn, :index))
|
||||
|
||||
{:error, changeset} ->
|
||||
{:error, %Ecto.Changeset{} = changeset} ->
|
||||
conn
|
||||
|> put_flash(:error, "Error creating user.")
|
||||
|> render("new.html", changeset: changeset)
|
||||
@@ -36,10 +32,10 @@ defmodule CfHttpWeb.UserController do
|
||||
|
||||
# GET /user/edit
|
||||
def edit(conn, _params) do
|
||||
changeset = User.changeset(conn.current_user)
|
||||
user = conn.current_user
|
||||
changeset = Users.change_user(user)
|
||||
|
||||
conn
|
||||
|> render("edit.html", changeset: changeset)
|
||||
render(conn, "edit.html", changeset: changeset)
|
||||
end
|
||||
|
||||
# GET /user
|
||||
@@ -73,7 +69,7 @@ defmodule CfHttpWeb.UserController do
|
||||
conn
|
||||
|> assign(:current_user, nil)
|
||||
|> put_flash(:info, "User deleted successfully.")
|
||||
|> redirect(to: Routes.page_path(conn, :index))
|
||||
|> redirect(to: "/")
|
||||
|
||||
{:error, _changeset} ->
|
||||
conn
|
||||
|
||||
@@ -4,7 +4,7 @@ defmodule CfHttpWeb.Plugs.Authenticator do
|
||||
"""
|
||||
|
||||
import Plug.Conn
|
||||
alias CfHttp.User
|
||||
alias CfHttp.Users.User
|
||||
|
||||
def init(default), do: default
|
||||
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
defmodule CfHttpWeb.Router do
|
||||
@moduledoc """
|
||||
Main Application Router
|
||||
"""
|
||||
|
||||
use CfHttpWeb, :router
|
||||
|
||||
pipeline :browser do
|
||||
@@ -16,16 +20,18 @@ defmodule CfHttpWeb.Router do
|
||||
scope "/", CfHttpWeb do
|
||||
pipe_through :browser
|
||||
|
||||
get "/", PageController, :index
|
||||
|
||||
resources "/user", UserController, singleton: true, only: [:show, :edit, :update, :delete]
|
||||
resources "/users", UserController, only: [:new, :create]
|
||||
|
||||
resources "/devices", DeviceController, except: [:create] do
|
||||
resources "/firewall_rules", FirewallRuleController, only: [:new, :index, :create]
|
||||
resources "/rules", RuleController, only: [:new, :index, :create]
|
||||
end
|
||||
|
||||
resources "/firewall_rules", FirewallRuleController, only: [:show, :update, :delete, :edit]
|
||||
resources "/rules", RuleController, only: [:show, :update, :delete, :edit]
|
||||
|
||||
resources "/sessions", SessionController, only: [:new, :create, :delete]
|
||||
|
||||
get "/", DeviceController, :index
|
||||
end
|
||||
|
||||
# Other scopes may use custom stacks.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<%= form_for @changeset, @action, fn f -> %>
|
||||
<%= if @changeset.action do %>
|
||||
<div class="alert alert-danger">
|
||||
<div>
|
||||
<p>Oops, something went wrong! Please check the errors below.</p>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
<h1>Edit Firewall rule</h1>
|
||||
|
||||
<%= render "form.html", Map.put(assigns, :action, Routes.firewall_rule_path(@conn, :update, @firewall_rule)) %>
|
||||
|
||||
<span><%= link "Back", to: Routes.firewall_rule_path(@conn, :index, @firewall_rule.device) %></span>
|
||||
@@ -1,32 +0,0 @@
|
||||
<h1>Listing Firewall rules</h1>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Destination</th>
|
||||
<th>Port</th>
|
||||
<th>Protocol</th>
|
||||
<th>Enabled</th>
|
||||
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%= for firewall_rule <- @firewall_rules do %>
|
||||
<tr>
|
||||
<td><%= firewall_rule.destination %></td>
|
||||
<td><%= firewall_rule.port %></td>
|
||||
<td><%= firewall_rule.protocol %></td>
|
||||
<td><%= firewall_rule.enabled %></td>
|
||||
|
||||
<td>
|
||||
<span><%= link "Show", to: Routes.firewall_rule_path(@conn, :show, firewall_rule) %></span>
|
||||
<span><%= link "Edit", to: Routes.firewall_rule_path(@conn, :edit, firewall_rule) %></span>
|
||||
<span><%= link "Delete", to: Routes.firewall_rule_path(@conn, :delete, firewall_rule), method: :delete, data: [confirm: "Are you sure?"] %></span>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<span><%= link "New Firewall rule", to: Routes.firewall_rule_path(@conn, :new, @device) %></span>
|
||||
@@ -1,5 +0,0 @@
|
||||
<h1>New Firewall rule</h1>
|
||||
|
||||
<%= render "form.html", Map.put(assigns, :action, Routes.firewall_rule_path(@conn, :create, @device)) %>
|
||||
|
||||
<span><%= link "Back", to: Routes.firewall_rule_path(@conn, :index, @device) %></span>
|
||||
@@ -1,28 +0,0 @@
|
||||
<h1>Show Firewall rule</h1>
|
||||
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
<strong>Destination:</strong>
|
||||
<%= @firewall_rule.destination %>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<strong>Port:</strong>
|
||||
<%= @firewall_rule.port %>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<strong>Protocol:</strong>
|
||||
<%= @firewall_rule.protocol %>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<strong>Enabled:</strong>
|
||||
<%= @firewall_rule.enabled %>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<span><%= link "Edit", to: Routes.firewall_rule_path(@conn, :edit, @firewall_rule) %></span>
|
||||
<span><%= link "Back", to: Routes.firewall_rule_path(@conn, :index, @firewall_rule.device) %></span>
|
||||
@@ -6,26 +6,23 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<title>FireGuard</title>
|
||||
<link rel="stylesheet" href="<%= Routes.static_path(@conn, "/css/app.css") %>"/>
|
||||
<link rel="stylesheet" href="https://unpkg.com/tachyons@4/css/tachyons.min.css">
|
||||
<%= csrf_meta_tag() %>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<section class="container">
|
||||
<nav role="navigation">
|
||||
<ul>
|
||||
<li><a href="<%= Routes.device_path(@conn, :index) %>">Devices</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<a href="<%= CfHttpWeb.Endpoint.url() %>" class="cf-logo">
|
||||
<img src="<%= Routes.static_path(@conn, "/images/logo.svg") %>" alt="FireGuard Logo"/>
|
||||
</a>
|
||||
</section>
|
||||
<header class="w-100 fixed bg-black-90 ph3 pv3 ph4-m ph5-l">
|
||||
<nav class="f6 fw6 ttu tracked fl">
|
||||
<a class="link dim white dib mr3" href="<%= CfHttpWeb.Endpoint.url() %>">FireGuard</a>
|
||||
</nav>
|
||||
<nav class="f6 fw6 ttu tracked fr">
|
||||
<a class="link dim white dib mr3" href="<%= Routes.device_path(@conn, :index) %>">Devices</a>
|
||||
</nav>
|
||||
</header>
|
||||
<main role="main" class="container">
|
||||
<p class="alert alert-info" role="alert"><%= get_flash(@conn, :info) %></p>
|
||||
<p class="alert alert-danger" role="alert"><%= get_flash(@conn, :error) %></p>
|
||||
<hr>
|
||||
<main>
|
||||
<%= @inner_content %>
|
||||
</main>
|
||||
|
||||
<script type="text/javascript" src="<%= Routes.static_path(@conn, "/js/app.js") %>"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
Welcome!
|
||||
@@ -0,0 +1,5 @@
|
||||
<h1>Edit Rule</h1>
|
||||
|
||||
<%= render "form.html", Map.put(assigns, :action, Routes.rule_path(@conn, :update, @rule)) %>
|
||||
|
||||
<span><%= link "Back", to: Routes.rule_path(@conn, :index, @rule.device) %></span>
|
||||
@@ -1,6 +1,6 @@
|
||||
<%= form_for @changeset, @action, fn f -> %>
|
||||
<%= if @changeset.action do %>
|
||||
<div class="alert alert-danger">
|
||||
<div>
|
||||
<p>Oops, something went wrong! Please check the errors below.</p>
|
||||
</div>
|
||||
<% end %>
|
||||
32
apps/cf_http/lib/cf_http_web/templates/rule/index.html.eex
Normal file
32
apps/cf_http/lib/cf_http_web/templates/rule/index.html.eex
Normal file
@@ -0,0 +1,32 @@
|
||||
<h1>Listing Rules</h1>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Destination</th>
|
||||
<th>Port</th>
|
||||
<th>Protocol</th>
|
||||
<th>Enabled</th>
|
||||
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%= for rule <- @rules do %>
|
||||
<tr>
|
||||
<td><%= rule.destination %></td>
|
||||
<td><%= rule.port %></td>
|
||||
<td><%= rule.protocol %></td>
|
||||
<td><%= rule.enabled %></td>
|
||||
|
||||
<td>
|
||||
<span><%= link "Show", to: Routes.rule_path(@conn, :show, rule) %></span>
|
||||
<span><%= link "Edit", to: Routes.rule_path(@conn, :edit, rule) %></span>
|
||||
<span><%= link "Delete", to: Routes.rule_path(@conn, :delete, rule), method: :delete, data: [confirm: "Are you sure?"] %></span>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<span><%= link "New Rule", to: Routes.rule_path(@conn, :new, @device) %></span>
|
||||
5
apps/cf_http/lib/cf_http_web/templates/rule/new.html.eex
Normal file
5
apps/cf_http/lib/cf_http_web/templates/rule/new.html.eex
Normal file
@@ -0,0 +1,5 @@
|
||||
<h1>New Rule</h1>
|
||||
|
||||
<%= render "form.html", Map.put(assigns, :action, Routes.rule_path(@conn, :create, @device)) %>
|
||||
|
||||
<span><%= link "Back", to: Routes.rule_path(@conn, :index, @device) %></span>
|
||||
28
apps/cf_http/lib/cf_http_web/templates/rule/show.html.eex
Normal file
28
apps/cf_http/lib/cf_http_web/templates/rule/show.html.eex
Normal file
@@ -0,0 +1,28 @@
|
||||
<h1>Show Rule</h1>
|
||||
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
<strong>Destination:</strong>
|
||||
<%= @rule.destination %>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<strong>Port:</strong>
|
||||
<%= @rule.port %>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<strong>Protocol:</strong>
|
||||
<%= @rule.protocol %>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<strong>Enabled:</strong>
|
||||
<%= @rule.enabled %>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<span><%= link "Edit", to: Routes.rule_path(@conn, :edit, @rule) %></span>
|
||||
<span><%= link "Back", to: Routes.rule_path(@conn, :index, @rule.device) %></span>
|
||||
23
apps/cf_http/lib/cf_http_web/templates/session/new.html.eex
Normal file
23
apps/cf_http/lib/cf_http_web/templates/session/new.html.eex
Normal file
@@ -0,0 +1,23 @@
|
||||
<main class="pa4 black-80">
|
||||
<form class="measure center">
|
||||
<fieldset id="sign_up" class="ba b--transparent ph0 mh0">
|
||||
<legend class="f4 fw6 ph0 mh0">Sign In</legend>
|
||||
<div class="mt3">
|
||||
<label class="db fw6 lh-copy f6" for="email-address">Email</label>
|
||||
<input class="pa2 input-reset ba bg-transparent hover-bg-black hover-white w-100" type="email" name="email-address" id="email-address">
|
||||
</div>
|
||||
<div class="mv3">
|
||||
<label class="db fw6 lh-copy f6" for="password">Password</label>
|
||||
<input class="b pa2 input-reset ba bg-transparent hover-bg-black hover-white w-100" type="password" name="password" id="password">
|
||||
</div>
|
||||
<label class="pa0 ma0 lh-copy f6 pointer"><input type="checkbox"> Remember me</label>
|
||||
</fieldset>
|
||||
<div class="">
|
||||
<input class="b ph3 pv2 input-reset ba b--black bg-transparent grow pointer f6 dib" type="submit" value="Sign in">
|
||||
</div>
|
||||
<div class="lh-copy mt3">
|
||||
<a href="#0" class="f6 link dim black db">Sign up</a>
|
||||
<a href="#0" class="f6 link dim black db">Forgot your password?</a>
|
||||
</div>
|
||||
</form>
|
||||
</main>
|
||||
@@ -1,3 +0,0 @@
|
||||
defmodule CfHttpWeb.FirewallRuleView do
|
||||
use CfHttpWeb, :view
|
||||
end
|
||||
@@ -1,3 +0,0 @@
|
||||
defmodule CfHttpWeb.PageView do
|
||||
use CfHttpWeb, :view
|
||||
end
|
||||
3
apps/cf_http/lib/cf_http_web/views/rule_view.ex
Normal file
3
apps/cf_http/lib/cf_http_web/views/rule_view.ex
Normal file
@@ -0,0 +1,3 @@
|
||||
defmodule CfHttpWeb.RuleView do
|
||||
use CfHttpWeb, :view
|
||||
end
|
||||
@@ -1,14 +1,17 @@
|
||||
defmodule CfHttp.Repo.Migrations.CreateFirewallRules do
|
||||
defmodule CfHttp.Repo.Migrations.CreateRules do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
create table(:firewall_rules) do
|
||||
create table(:rules) do
|
||||
add :destination, :inet
|
||||
add :port, :string
|
||||
add :protocol, :string
|
||||
add :enabled, :boolean, default: false, null: false
|
||||
add :device_id, references(:devices, on_delete: :delete_all)
|
||||
|
||||
timestamps()
|
||||
end
|
||||
|
||||
create index(:rules, [:device_id])
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,13 @@
|
||||
defmodule CfHttp.Repo.Migrations.CreateSessions do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
create table(:sessions) do
|
||||
add :user_id, references(:users, on_delete: :delete_all)
|
||||
|
||||
timestamps()
|
||||
end
|
||||
|
||||
create index(:sessions, [:user_id])
|
||||
end
|
||||
end
|
||||
@@ -1,6 +0,0 @@
|
||||
defmodule CfHttp.FirewallRulesTest do
|
||||
use CfHttp.DataCase
|
||||
|
||||
describe "firewall_rules" do
|
||||
end
|
||||
end
|
||||
6
apps/cf_http/test/cf_http/rules_test.exs
Normal file
6
apps/cf_http/test/cf_http/rules_test.exs
Normal file
@@ -0,0 +1,6 @@
|
||||
defmodule CfHttp.RulesTest do
|
||||
use CfHttp.DataCase
|
||||
|
||||
describe "rules" do
|
||||
end
|
||||
end
|
||||
@@ -1,21 +0,0 @@
|
||||
defmodule CfHttpWeb.FirewallRuleControllerTest do
|
||||
use CfHttpWeb.ConnCase
|
||||
|
||||
describe "index" do
|
||||
end
|
||||
|
||||
describe "new firewall_rule" do
|
||||
end
|
||||
|
||||
describe "create firewall_rule" do
|
||||
end
|
||||
|
||||
describe "edit firewall_rule" do
|
||||
end
|
||||
|
||||
describe "update firewall_rule" do
|
||||
end
|
||||
|
||||
describe "delete firewall_rule" do
|
||||
end
|
||||
end
|
||||
@@ -1,8 +0,0 @@
|
||||
defmodule CfHttpWeb.PageControllerTest do
|
||||
use CfHttpWeb.ConnCase
|
||||
|
||||
test "GET /", %{conn: conn} do
|
||||
conn = get(conn, "/")
|
||||
assert html_response(conn, 200) =~ "Welcome!"
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,21 @@
|
||||
defmodule CfHttpWeb.RuleControllerTest do
|
||||
use CfHttpWeb.ConnCase
|
||||
|
||||
describe "index" do
|
||||
end
|
||||
|
||||
describe "new rule" do
|
||||
end
|
||||
|
||||
describe "create rule" do
|
||||
end
|
||||
|
||||
describe "edit rule" do
|
||||
end
|
||||
|
||||
describe "update rule" do
|
||||
end
|
||||
|
||||
describe "delete rule" do
|
||||
end
|
||||
end
|
||||
@@ -1,3 +0,0 @@
|
||||
defmodule CfHttpWeb.PageViewTest do
|
||||
use CfHttpWeb.ConnCase, async: true
|
||||
end
|
||||
@@ -27,7 +27,7 @@ config :cf_http, CfHttpWeb.Endpoint,
|
||||
url: [host: "localhost"],
|
||||
secret_key_base: "5OVYJ83AcoQcPmdKNksuBhJFBhjHD1uUa9mDOHV/6EIdBQ6pXksIhkVeWIzFk5SD",
|
||||
render_errors: [view: CfHttpWeb.ErrorView, accepts: ~w(html json)],
|
||||
pubsub_server: [name: CfHttp.PubSub]
|
||||
pubsub_server: CfHttp.PubSub
|
||||
|
||||
# Configures Elixir's Logger
|
||||
config :logger, :console,
|
||||
|
||||
@@ -26,7 +26,7 @@ config :cf_http, CfHttpWeb.Endpoint,
|
||||
"--mode",
|
||||
"development",
|
||||
"--watch-stdin",
|
||||
cd: Path.expand("../assets", __DIR__)
|
||||
cd: Path.expand("../apps/cf_http/assets", __DIR__)
|
||||
]
|
||||
]
|
||||
|
||||
@@ -58,10 +58,10 @@ config :cf_http, CfHttpWeb.Endpoint,
|
||||
config :cf_http, CfHttpWeb.Endpoint,
|
||||
live_reload: [
|
||||
patterns: [
|
||||
~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",
|
||||
~r"priv/gettext/.*(po)$",
|
||||
~r"lib/cf_http_web/(live|views)/.*(ex)$",
|
||||
~r"lib/cf_http_web/templates/.*(eex)$"
|
||||
~r"apps/cf_http/priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",
|
||||
~r"apps/cf_http/priv/gettext/.*(po)$",
|
||||
~r"apps/cf_http/lib/cf_http_web/(live|views)/.*(ex)$",
|
||||
~r"apps/cf_http/lib/cf_http_web/templates/.*(eex)$"
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
4
mix.exs
4
mix.exs
@@ -32,8 +32,6 @@ defmodule FireguardUmbrella.MixProject do
|
||||
#
|
||||
# Run "mix help deps" for examples and options.
|
||||
defp deps do
|
||||
[
|
||||
{:credo, "~> 1.4", only: [:dev, :test], runtime: false}
|
||||
]
|
||||
[]
|
||||
end
|
||||
end
|
||||
|
||||
10
mix.lock
10
mix.lock
@@ -4,18 +4,18 @@
|
||||
"cowboy": {:hex, :cowboy, "2.7.0", "91ed100138a764355f43316b1d23d7ff6bdb0de4ea618cb5d8677c93a7a2f115", [:rebar3], [{:cowlib, "~> 2.8.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "~> 1.7.1", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "04fd8c6a39edc6aaa9c26123009200fc61f92a3a94f3178c527b70b767c6e605"},
|
||||
"cowlib": {:hex, :cowlib, "2.8.0", "fd0ff1787db84ac415b8211573e9a30a3ebe71b5cbff7f720089972b2319c8a4", [:rebar3], [], "hexpm", "79f954a7021b302186a950a32869dbc185523d99d3e44ce430cd1f3289f41ed4"},
|
||||
"credo": {:hex, :credo, "1.4.0", "92339d4cbadd1e88b5ee43d427b639b68a11071b6f73854e33638e30a0ea11f5", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "1fd3b70dce216574ce3c18bdf510b57e7c4c85c2ec9cad4bff854abaf7e58658"},
|
||||
"db_connection": {:hex, :db_connection, "2.2.1", "caee17725495f5129cb7faebde001dc4406796f12a62b8949f4ac69315080566", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, repo: "hexpm", optional: false]}], "hexpm", "2b02ece62d9f983fcd40954e443b7d9e6589664380e5546b2b9b523cd0fb59e1"},
|
||||
"db_connection": {:hex, :db_connection, "2.2.2", "3bbca41b199e1598245b716248964926303b5d4609ff065125ce98bcd368939e", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, repo: "hexpm", optional: false]}], "hexpm", "642af240d8a8affb93b4ba5a6fcd2bbcbdc327e1a524b825d383711536f8070c"},
|
||||
"decimal": {:hex, :decimal, "1.8.1", "a4ef3f5f3428bdbc0d35374029ffcf4ede8533536fa79896dd450168d9acdf3c", [:mix], [], "hexpm", "3cb154b00225ac687f6cbd4acc4b7960027c757a5152b369923ead9ddbca7aec"},
|
||||
"ecto": {:hex, :ecto, "3.4.1", "ca5b5f6314eebd7fa2e52c6d78abb1ef955005dd60cc7a047b963ee23ee14a6c", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "748a317a2eacac0b7b6540cb7d2198b79457ede9cec2b4d1582117f90ac309d5"},
|
||||
"ecto": {:hex, :ecto, "3.4.3", "3a14c2500c3964165245a4f24a463e080762f7ccd0c632c763ea589f75ca205f", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "9b6f18dea95f2004d0369f6a8346513ca3f706614f4ede219a5f3fe5db5dd962"},
|
||||
"ecto_network": {:hex, :ecto_network, "1.3.0", "1e77fa37c20e0f6a426d3862732f3317b0fa4c18f123d325f81752a491d7304e", [:mix], [{:ecto_sql, ">= 3.0.0", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:phoenix_html, ">= 0.0.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:postgrex, ">= 0.14.0", [hex: :postgrex, repo: "hexpm", optional: false]}], "hexpm", "053a5e46ef2837e8ea5ea97c82fa0f5494699209eddd764e663c85f11b2865bd"},
|
||||
"ecto_sql": {:hex, :ecto_sql, "3.4.2", "3d842665a81ba2137b62aa70151afe81dae44824cd09b2076a255937ab4e2dc9", [:mix], [{:db_connection, "~> 2.2", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.4.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.3.0 or ~> 0.4.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.15.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.0", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "f2b064102467e1525314a464b6fea0707ff28ee132a15006727ccf51b73492ff"},
|
||||
"ecto_sql": {:hex, :ecto_sql, "3.4.3", "c552aa8a7ccff2b64024f835503b3155d8e73452c180298527fbdbcd6e79710b", [:mix], [{:db_connection, "~> 2.2", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.4.3", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.3.0 or ~> 0.4.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.15.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.0", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "ec9e59d6fa3f8cfda9963ada371e9e6659167c2338a997bd7ea23b10b245842b"},
|
||||
"file_system": {:hex, :file_system, "0.2.8", "f632bd287927a1eed2b718f22af727c5aeaccc9a98d8c2bd7bff709e851dc986", [:mix], [], "hexpm", "97a3b6f8d63ef53bd0113070102db2ce05352ecf0d25390eb8d747c2bde98bca"},
|
||||
"gettext": {:hex, :gettext, "0.17.4", "f13088e1ec10ce01665cf25f5ff779e7df3f2dc71b37084976cf89d1aa124d5c", [:mix], [], "hexpm", "3c75b5ea8288e2ee7ea503ff9e30dfe4d07ad3c054576a6e60040e79a801e14d"},
|
||||
"jason": {:hex, :jason, "1.2.0", "10043418c42d2493d0ee212d3fddd25d7ffe484380afad769a0a38795938e448", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "116747dbe057794c3a3e4e143b7c8390b29f634e16c78a7f59ba75bfa6852e7f"},
|
||||
"jason": {:hex, :jason, "1.2.1", "12b22825e22f468c02eb3e4b9985f3d0cb8dc40b9bd704730efa11abd2708c44", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "b659b8571deedf60f79c5a608e15414085fa141344e2716fbd6988a084b5f993"},
|
||||
"mime": {:hex, :mime, "1.3.1", "30ce04ab3175b6ad0bdce0035cba77bba68b813d523d1aac73d9781b4d193cf8", [:mix], [], "hexpm", "6cbe761d6a0ca5a31a0931bf4c63204bceb64538e664a8ecf784a9a6f3b875f1"},
|
||||
"phoenix": {:hex, :phoenix, "1.5.1", "95156589879dc69201d5fc0ebdbfdfc7901a09a3616ea611ec297f81340275a2", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_html, "~> 2.13", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.10", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 1.0 or ~> 2.2", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.1.2 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "fc272b38e79d2881790fccae6f67a9fbe9b790103d6878175ea03d23003152eb"},
|
||||
"phoenix_ecto": {:hex, :phoenix_ecto, "4.1.0", "a044d0756d0464c5a541b4a0bf4bcaf89bffcaf92468862408290682c73ae50d", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.9", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "c5e666a341ff104d0399d8f0e4ff094559b2fde13a5985d4cb5023b2c2ac558b"},
|
||||
"phoenix_html": {:hex, :phoenix_html, "2.14.1", "7dabafadedb552db142aacbd1f11de1c0bbaa247f90c449ca549d5e30bbc66b4", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "536d5200ad37fecfe55b3241d90b7a8c3a2ca60cd012fc065f776324fa9ab0a9"},
|
||||
"phoenix_html": {:hex, :phoenix_html, "2.14.2", "b8a3899a72050f3f48a36430da507dd99caf0ac2d06c77529b1646964f3d563e", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "58061c8dfd25da5df1ea0ca47c972f161beb6c875cd293917045b92ffe1bf617"},
|
||||
"phoenix_live_reload": {:hex, :phoenix_live_reload, "1.2.1", "274a4b07c4adbdd7785d45a8b0bb57634d0b4f45b18d2c508b26c0344bd59b8f", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.4", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm", "41b4103a2fa282cfd747d377233baf213c648fdcc7928f432937676532490eee"},
|
||||
"phoenix_pubsub": {:hex, :phoenix_pubsub, "2.0.0", "a1ae76717bb168cdeb10ec9d92d1480fec99e3080f011402c0a2d68d47395ffb", [:mix], [], "hexpm", "c52d948c4f261577b9c6fa804be91884b381a7f8f18450c5045975435350f771"},
|
||||
"plug": {:hex, :plug, "1.10.0", "6508295cbeb4c654860845fb95260737e4a8838d34d115ad76cd487584e2fc4d", [:mix], [{:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm", "422a9727e667be1bf5ab1de03be6fa0ad67b775b2d84ed908f3264415ef29d4a"},
|
||||
|
||||
Reference in New Issue
Block a user