mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
@@ -1,3 +0,0 @@
|
||||
# CfHttp
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
defmodule CfHttpWeb.DeviceView do
|
||||
use CfHttpWeb, :view
|
||||
end
|
||||
@@ -1,3 +0,0 @@
|
||||
defmodule CfHttpWeb.LayoutView do
|
||||
use CfHttpWeb, :view
|
||||
end
|
||||
@@ -1,3 +0,0 @@
|
||||
defmodule CfHttpWeb.RuleView do
|
||||
use CfHttpWeb, :view
|
||||
end
|
||||
@@ -1,3 +0,0 @@
|
||||
defmodule CfHttpWeb.UserView do
|
||||
use CfHttpWeb, :view
|
||||
end
|
||||
@@ -1,6 +0,0 @@
|
||||
defmodule CfHttp.DevicesTest do
|
||||
use CfHttp.DataCase
|
||||
|
||||
describe "devices" do
|
||||
end
|
||||
end
|
||||
@@ -1,6 +0,0 @@
|
||||
defmodule CfHttp.RulesTest do
|
||||
use CfHttp.DataCase
|
||||
|
||||
describe "rules" do
|
||||
end
|
||||
end
|
||||
@@ -1,2 +0,0 @@
|
||||
ExUnit.start()
|
||||
Ecto.Adapters.SQL.Sandbox.mode(CfHttp.Repo, :manual)
|
||||
@@ -1,8 +0,0 @@
|
||||
defmodule CfVpnTest do
|
||||
use ExUnit.Case
|
||||
doctest CfVpn
|
||||
|
||||
test "greets the world" do
|
||||
assert CfVpn.hello() == :world
|
||||
end
|
||||
end
|
||||
@@ -1,8 +0,0 @@
|
||||
defmodule CfWallTest do
|
||||
use ExUnit.Case
|
||||
doctest CfWall
|
||||
|
||||
test "greets the world" do
|
||||
assert CfWall.hello() == :world
|
||||
end
|
||||
end
|
||||
3
apps/fg_http/README.md
Normal file
3
apps/fg_http/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# FgHttp
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
@@ -1,6 +1,6 @@
|
||||
defmodule CfHttp do
|
||||
defmodule FgHttp do
|
||||
@moduledoc """
|
||||
CfHttp keeps the contexts that define your domain
|
||||
FgHttp keeps the contexts that define your domain
|
||||
and business logic.
|
||||
|
||||
Contexts are also responsible for managing your data, regardless
|
||||
@@ -1,4 +1,4 @@
|
||||
defmodule CfHttp.Application do
|
||||
defmodule FgHttp.Application do
|
||||
# See https://hexdocs.pm/elixir/Application.html
|
||||
# for more information on OTP Applications
|
||||
@moduledoc false
|
||||
@@ -9,25 +9,25 @@ defmodule CfHttp.Application do
|
||||
# List all child processes to be supervised
|
||||
children = [
|
||||
# Start the Ecto repository
|
||||
CfHttp.Repo,
|
||||
FgHttp.Repo,
|
||||
# Start the PubSub system
|
||||
{Phoenix.PubSub, name: CfHttp.PubSub},
|
||||
{Phoenix.PubSub, name: FgHttp.PubSub},
|
||||
# Start the endpoint when the application starts
|
||||
CfHttpWeb.Endpoint
|
||||
# Starts a worker by calling: CfHttp.Worker.start_link(arg)
|
||||
# {CfHttp.Worker, arg},
|
||||
FgHttpWeb.Endpoint
|
||||
# Starts a worker by calling: FgHttp.Worker.start_link(arg)
|
||||
# {FgHttp.Worker, arg},
|
||||
]
|
||||
|
||||
# See https://hexdocs.pm/elixir/Supervisor.html
|
||||
# for other strategies and supported options
|
||||
opts = [strategy: :one_for_one, name: CfHttp.Supervisor]
|
||||
opts = [strategy: :one_for_one, name: FgHttp.Supervisor]
|
||||
Supervisor.start_link(children, opts)
|
||||
end
|
||||
|
||||
# Tell Phoenix to update the endpoint configuration
|
||||
# whenever the application is updated.
|
||||
def config_change(changed, _new, removed) do
|
||||
CfHttpWeb.Endpoint.config_change(changed, removed)
|
||||
FgHttpWeb.Endpoint.config_change(changed, removed)
|
||||
:ok
|
||||
end
|
||||
end
|
||||
@@ -1,12 +1,12 @@
|
||||
defmodule CfHttp.Devices do
|
||||
defmodule FgHttp.Devices do
|
||||
@moduledoc """
|
||||
The Devices context.
|
||||
"""
|
||||
|
||||
import Ecto.Query, warn: false
|
||||
alias CfHttp.Repo
|
||||
alias FgHttp.Repo
|
||||
|
||||
alias CfHttp.Devices.Device
|
||||
alias FgHttp.Devices.Device
|
||||
|
||||
@doc """
|
||||
Returns the list of devices.
|
||||
@@ -1,4 +1,4 @@
|
||||
defmodule CfHttp.Devices.Device do
|
||||
defmodule FgHttp.Devices.Device do
|
||||
@moduledoc """
|
||||
Manages Device things
|
||||
"""
|
||||
@@ -12,7 +12,7 @@ defmodule CfHttp.Devices.Device do
|
||||
field :verified_at, :utc_datetime
|
||||
field :user_id, :id
|
||||
|
||||
has_many :rules, CfHttp.Rules.Rule
|
||||
has_many :rules, FgHttp.Rules.Rule
|
||||
|
||||
timestamps()
|
||||
end
|
||||
@@ -1,9 +1,9 @@
|
||||
defmodule CfHttp.Release do
|
||||
defmodule FgHttp.Release do
|
||||
@moduledoc """
|
||||
Configures the Mix Release or something
|
||||
"""
|
||||
|
||||
@app :cf_http
|
||||
@app :fg_http
|
||||
|
||||
def migrate do
|
||||
load_app()
|
||||
@@ -1,5 +1,5 @@
|
||||
defmodule CfHttp.Repo do
|
||||
defmodule FgHttp.Repo do
|
||||
use Ecto.Repo,
|
||||
otp_app: :cf_http,
|
||||
otp_app: :fg_http,
|
||||
adapter: Ecto.Adapters.Postgres
|
||||
end
|
||||
@@ -1,12 +1,12 @@
|
||||
defmodule CfHttp.Rules do
|
||||
defmodule FgHttp.Rules do
|
||||
@moduledoc """
|
||||
The Rules context.
|
||||
"""
|
||||
|
||||
import Ecto.Query, warn: false
|
||||
alias CfHttp.Repo
|
||||
alias FgHttp.Repo
|
||||
|
||||
alias CfHttp.Rules.Rule
|
||||
alias FgHttp.Rules.Rule
|
||||
|
||||
@doc """
|
||||
Returns the list of rules.
|
||||
@@ -1,4 +1,4 @@
|
||||
defmodule CfHttp.Rules.Rule do
|
||||
defmodule FgHttp.Rules.Rule do
|
||||
@moduledoc """
|
||||
Not really sure what to write here. I'll update this later.
|
||||
"""
|
||||
@@ -12,7 +12,7 @@ defmodule CfHttp.Rules.Rule do
|
||||
field :port, :string
|
||||
field :protocol, :string
|
||||
|
||||
belongs_to :device, CfHttp.Devices.Device
|
||||
belongs_to :device, FgHttp.Devices.Device
|
||||
|
||||
timestamps()
|
||||
end
|
||||
@@ -1,12 +1,12 @@
|
||||
defmodule CfHttp.Sessions do
|
||||
defmodule FgHttp.Sessions do
|
||||
@moduledoc """
|
||||
The Sessions context.
|
||||
"""
|
||||
|
||||
import Ecto.Query, warn: false
|
||||
alias CfHttp.Repo
|
||||
alias FgHttp.Repo
|
||||
|
||||
alias CfHttp.Sessions.Session
|
||||
alias FgHttp.Sessions.Session
|
||||
|
||||
@doc """
|
||||
Returns the list of sessions.
|
||||
@@ -1,4 +1,4 @@
|
||||
defmodule CfHttp.Sessions.Session do
|
||||
defmodule FgHttp.Sessions.Session do
|
||||
@moduledoc """
|
||||
Represents a Session
|
||||
"""
|
||||
@@ -1,12 +1,12 @@
|
||||
defmodule CfHttp.Users do
|
||||
defmodule FgHttp.Users do
|
||||
@moduledoc """
|
||||
The Users context.
|
||||
"""
|
||||
|
||||
import Ecto.Query, warn: false
|
||||
alias CfHttp.Repo
|
||||
alias FgHttp.Repo
|
||||
|
||||
alias CfHttp.Users.User
|
||||
alias FgHttp.Users.User
|
||||
|
||||
@doc """
|
||||
Returns the list of users.
|
||||
@@ -1,4 +1,4 @@
|
||||
defmodule CfHttp.Users.User do
|
||||
defmodule FgHttp.Users.User do
|
||||
@moduledoc """
|
||||
Represents a User I guess
|
||||
"""
|
||||
@@ -1,12 +1,12 @@
|
||||
defmodule CfHttpWeb do
|
||||
defmodule FgHttpWeb do
|
||||
@moduledoc """
|
||||
The entrypoint for defining your web interface, such
|
||||
as controllers, views, channels and so on.
|
||||
|
||||
This can be used in your application as:
|
||||
|
||||
use CfHttpWeb, :controller
|
||||
use CfHttpWeb, :view
|
||||
use FgHttpWeb, :controller
|
||||
use FgHttpWeb, :view
|
||||
|
||||
The definitions below will be executed for every view,
|
||||
controller, etc, so keep them short and clean, focused
|
||||
@@ -19,19 +19,19 @@ defmodule CfHttpWeb do
|
||||
|
||||
def controller do
|
||||
quote do
|
||||
use Phoenix.Controller, namespace: CfHttpWeb
|
||||
use Phoenix.Controller, namespace: FgHttpWeb
|
||||
|
||||
import Plug.Conn
|
||||
import CfHttpWeb.Gettext
|
||||
alias CfHttpWeb.Router.Helpers, as: Routes
|
||||
import FgHttpWeb.Gettext
|
||||
alias FgHttpWeb.Router.Helpers, as: Routes
|
||||
end
|
||||
end
|
||||
|
||||
def view do
|
||||
quote do
|
||||
use Phoenix.View,
|
||||
root: "lib/cf_http_web/templates",
|
||||
namespace: CfHttpWeb
|
||||
root: "lib/fg_http_web/templates",
|
||||
namespace: FgHttpWeb
|
||||
|
||||
# Import convenience functions from controllers
|
||||
import Phoenix.Controller, only: [get_flash: 1, get_flash: 2, view_module: 1]
|
||||
@@ -39,9 +39,9 @@ defmodule CfHttpWeb do
|
||||
# Use all HTML functionality (forms, tags, etc)
|
||||
use Phoenix.HTML
|
||||
|
||||
import CfHttpWeb.ErrorHelpers
|
||||
import CfHttpWeb.Gettext
|
||||
alias CfHttpWeb.Router.Helpers, as: Routes
|
||||
import FgHttpWeb.ErrorHelpers
|
||||
import FgHttpWeb.Gettext
|
||||
alias FgHttpWeb.Router.Helpers, as: Routes
|
||||
end
|
||||
end
|
||||
|
||||
@@ -56,7 +56,7 @@ defmodule CfHttpWeb do
|
||||
def channel do
|
||||
quote do
|
||||
use Phoenix.Channel
|
||||
import CfHttpWeb.Gettext
|
||||
import FgHttpWeb.Gettext
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
defmodule CfHttpWeb.UserSocket do
|
||||
defmodule FgHttpWeb.UserSocket do
|
||||
use Phoenix.Socket
|
||||
|
||||
## Channels
|
||||
# channel "room:*", CfHttpWeb.RoomChannel
|
||||
# channel "room:*", FgHttpWeb.RoomChannel
|
||||
|
||||
# Socket params are passed from the client and can
|
||||
# be used to verify and authenticate a user. After
|
||||
@@ -26,7 +26,7 @@ defmodule CfHttpWeb.UserSocket do
|
||||
# Would allow you to broadcast a "disconnect" event and terminate
|
||||
# all active sockets and channels for a given user:
|
||||
#
|
||||
# CfHttpWeb.Endpoint.broadcast("user_socket:#{user.id}", "disconnect", %{})
|
||||
# FgHttpWeb.Endpoint.broadcast("user_socket:#{user.id}", "disconnect", %{})
|
||||
#
|
||||
# Returning `nil` makes this socket anonymous.
|
||||
def id(_socket), do: nil
|
||||
@@ -1,12 +1,12 @@
|
||||
defmodule CfHttpWeb.DeviceController do
|
||||
defmodule FgHttpWeb.DeviceController do
|
||||
@moduledoc """
|
||||
Implements the CRUD for a Device
|
||||
"""
|
||||
|
||||
use CfHttpWeb, :controller
|
||||
alias CfHttp.{Devices, Devices.Device}
|
||||
use FgHttpWeb, :controller
|
||||
alias FgHttp.{Devices, Devices.Device}
|
||||
|
||||
plug CfHttpWeb.Plugs.Authenticator
|
||||
plug FgHttpWeb.Plugs.Authenticator
|
||||
|
||||
def index(conn, _params) do
|
||||
devices = Devices.list_devices()
|
||||
@@ -1,12 +1,12 @@
|
||||
defmodule CfHttpWeb.RuleController do
|
||||
defmodule FgHttpWeb.RuleController do
|
||||
@moduledoc """
|
||||
Controller logic for Rules
|
||||
"""
|
||||
|
||||
use CfHttpWeb, :controller
|
||||
alias CfHttp.{Devices, Rules, Rules.Rule}
|
||||
use FgHttpWeb, :controller
|
||||
alias FgHttp.{Devices, Rules, Rules.Rule}
|
||||
|
||||
plug CfHttpWeb.Plugs.Authenticator
|
||||
plug FgHttpWeb.Plugs.Authenticator
|
||||
|
||||
def index(conn, %{"device_id" => device_id}) do
|
||||
device = Devices.get_device!(device_id)
|
||||
@@ -1,13 +1,13 @@
|
||||
defmodule CfHttpWeb.SessionController do
|
||||
defmodule FgHttpWeb.SessionController do
|
||||
@moduledoc """
|
||||
Implements the CRUD for a Session
|
||||
"""
|
||||
|
||||
use CfHttpWeb, :controller
|
||||
alias CfHttp.{Repo, Users.User, Sessions, Sessions.Session}
|
||||
use FgHttpWeb, :controller
|
||||
alias FgHttp.{Repo, Users.User, Sessions.Session}
|
||||
|
||||
plug :redirect_authenticated when action in [:new]
|
||||
plug CfHttpWeb.Plugs.Authenticator when action in [:delete]
|
||||
plug FgHttpWeb.Plugs.Authenticator when action in [:delete]
|
||||
|
||||
# GET /sessions/new
|
||||
def new(conn, _params) do
|
||||
@@ -1,12 +1,12 @@
|
||||
defmodule CfHttpWeb.UserController do
|
||||
defmodule FgHttpWeb.UserController do
|
||||
@moduledoc """
|
||||
Implements the CRUD for a User
|
||||
"""
|
||||
|
||||
use CfHttpWeb, :controller
|
||||
alias CfHttp.{Repo, Users, Users.User}
|
||||
use FgHttpWeb, :controller
|
||||
alias FgHttp.{Repo, Users, Users.User}
|
||||
|
||||
plug CfHttpWeb.Plugs.Authenticator when action in [:show, :edit, :update, :delete]
|
||||
plug FgHttpWeb.Plugs.Authenticator when action in [:show, :edit, :update, :delete]
|
||||
|
||||
# GET /users/new
|
||||
def new(conn, _params) do
|
||||
@@ -16,7 +16,7 @@ defmodule CfHttpWeb.UserController do
|
||||
|
||||
# POST /users
|
||||
def create(conn, %{"user" => user_params}) do
|
||||
case Users.create_user(conn, user_params) do
|
||||
case Users.create_user(user_params) do
|
||||
{:ok, user} ->
|
||||
conn
|
||||
|> assign(:current_user, user)
|
||||
@@ -1,16 +1,16 @@
|
||||
defmodule CfHttpWeb.Endpoint do
|
||||
use Phoenix.Endpoint, otp_app: :cf_http
|
||||
defmodule FgHttpWeb.Endpoint do
|
||||
use Phoenix.Endpoint, otp_app: :fg_http
|
||||
|
||||
# The session will be stored in the cookie and signed,
|
||||
# this means its contents can be read but not tampered with.
|
||||
# Set :encryption_salt if you would also like to encrypt it.
|
||||
@session_options [
|
||||
store: :cookie,
|
||||
key: "_cf_http_key",
|
||||
key: "_fg_http_key",
|
||||
signing_salt: "Z9eq8iof"
|
||||
]
|
||||
|
||||
socket "/socket", CfHttpWeb.UserSocket,
|
||||
socket "/socket", FgHttpWeb.UserSocket,
|
||||
websocket: true,
|
||||
longpoll: false
|
||||
|
||||
@@ -20,7 +20,7 @@ defmodule CfHttpWeb.Endpoint do
|
||||
# when deploying your static files in production.
|
||||
plug Plug.Static,
|
||||
at: "/",
|
||||
from: :cf_http,
|
||||
from: :fg_http,
|
||||
gzip: false,
|
||||
only: ~w(css fonts images js favicon.ico robots.txt)
|
||||
|
||||
@@ -43,5 +43,5 @@ defmodule CfHttpWeb.Endpoint do
|
||||
plug Plug.MethodOverride
|
||||
plug Plug.Head
|
||||
plug Plug.Session, @session_options
|
||||
plug CfHttpWeb.Router
|
||||
plug FgHttpWeb.Router
|
||||
end
|
||||
@@ -1,11 +1,11 @@
|
||||
defmodule CfHttpWeb.Gettext do
|
||||
defmodule FgHttpWeb.Gettext do
|
||||
@moduledoc """
|
||||
A module providing Internationalization with a gettext-based API.
|
||||
|
||||
By using [Gettext](https://hexdocs.pm/gettext),
|
||||
your module gains a set of macros for translations, for example:
|
||||
|
||||
import CfHttpWeb.Gettext
|
||||
import FgHttpWeb.Gettext
|
||||
|
||||
# Simple translation
|
||||
gettext("Here is the string to translate")
|
||||
@@ -20,5 +20,5 @@ defmodule CfHttpWeb.Gettext do
|
||||
|
||||
See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage.
|
||||
"""
|
||||
use Gettext, otp_app: :cf_http
|
||||
use Gettext, otp_app: :fg_http
|
||||
end
|
||||
@@ -1,10 +1,10 @@
|
||||
defmodule CfHttpWeb.Plugs.Authenticator do
|
||||
defmodule FgHttpWeb.Plugs.Authenticator do
|
||||
@moduledoc """
|
||||
Loads the user's session from cookie
|
||||
"""
|
||||
|
||||
import Plug.Conn
|
||||
alias CfHttp.Users.User
|
||||
alias FgHttp.Users.User
|
||||
|
||||
def init(default), do: default
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
defmodule CfHttpWeb.Router do
|
||||
defmodule FgHttpWeb.Router do
|
||||
@moduledoc """
|
||||
Main Application Router
|
||||
"""
|
||||
|
||||
use CfHttpWeb, :router
|
||||
use FgHttpWeb, :router
|
||||
|
||||
pipeline :browser do
|
||||
plug :accepts, ["html"]
|
||||
@@ -17,7 +17,7 @@ defmodule CfHttpWeb.Router do
|
||||
plug :accepts, ["json"]
|
||||
end
|
||||
|
||||
scope "/", CfHttpWeb do
|
||||
scope "/", FgHttpWeb do
|
||||
pipe_through :browser
|
||||
|
||||
resources "/user", UserController, singleton: true, only: [:show, :edit, :update, :delete]
|
||||
@@ -35,7 +35,7 @@ defmodule CfHttpWeb.Router do
|
||||
end
|
||||
|
||||
# Other scopes may use custom stacks.
|
||||
# scope "/api", CfHttpWeb do
|
||||
# scope "/api", FgHttpWeb do
|
||||
# pipe_through :api
|
||||
# end
|
||||
end
|
||||
@@ -12,7 +12,7 @@
|
||||
<body>
|
||||
<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>
|
||||
<a class="link dim white dib mr3" href="<%= FgHttpWeb.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>
|
||||
3
apps/fg_http/lib/fg_http_web/views/device_view.ex
Normal file
3
apps/fg_http/lib/fg_http_web/views/device_view.ex
Normal file
@@ -0,0 +1,3 @@
|
||||
defmodule FgHttpWeb.DeviceView do
|
||||
use FgHttpWeb, :view
|
||||
end
|
||||
@@ -1,4 +1,4 @@
|
||||
defmodule CfHttpWeb.ErrorHelpers do
|
||||
defmodule FgHttpWeb.ErrorHelpers do
|
||||
@moduledoc """
|
||||
Conveniences for translating and building error messages.
|
||||
"""
|
||||
@@ -36,9 +36,9 @@ defmodule CfHttpWeb.ErrorHelpers do
|
||||
# should be written to the errors.po file. The :count option is
|
||||
# set by Ecto and indicates we should also apply plural rules.
|
||||
if count = opts[:count] do
|
||||
Gettext.dngettext(CfHttpWeb.Gettext, "errors", msg, msg, count, opts)
|
||||
Gettext.dngettext(FgHttpWeb.Gettext, "errors", msg, msg, count, opts)
|
||||
else
|
||||
Gettext.dgettext(CfHttpWeb.Gettext, "errors", msg, opts)
|
||||
Gettext.dgettext(FgHttpWeb.Gettext, "errors", msg, opts)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,5 +1,5 @@
|
||||
defmodule CfHttpWeb.ErrorView do
|
||||
use CfHttpWeb, :view
|
||||
defmodule FgHttpWeb.ErrorView do
|
||||
use FgHttpWeb, :view
|
||||
|
||||
# If you want to customize a particular status code
|
||||
# for a certain format, you may uncomment below.
|
||||
3
apps/fg_http/lib/fg_http_web/views/layout_view.ex
Normal file
3
apps/fg_http/lib/fg_http_web/views/layout_view.ex
Normal file
@@ -0,0 +1,3 @@
|
||||
defmodule FgHttpWeb.LayoutView do
|
||||
use FgHttpWeb, :view
|
||||
end
|
||||
3
apps/fg_http/lib/fg_http_web/views/rule_view.ex
Normal file
3
apps/fg_http/lib/fg_http_web/views/rule_view.ex
Normal file
@@ -0,0 +1,3 @@
|
||||
defmodule FgHttpWeb.RuleView do
|
||||
use FgHttpWeb, :view
|
||||
end
|
||||
3
apps/fg_http/lib/fg_http_web/views/user_view.ex
Normal file
3
apps/fg_http/lib/fg_http_web/views/user_view.ex
Normal file
@@ -0,0 +1,3 @@
|
||||
defmodule FgHttpWeb.UserView do
|
||||
use FgHttpWeb, :view
|
||||
end
|
||||
@@ -1,9 +1,9 @@
|
||||
defmodule CfHttp.MixProject do
|
||||
defmodule FgHttp.MixProject do
|
||||
use Mix.Project
|
||||
|
||||
def project do
|
||||
[
|
||||
app: :cf_http,
|
||||
app: :fg_http,
|
||||
version: "0.1.0",
|
||||
build_path: "../../_build",
|
||||
config_path: "../../config/config.exs",
|
||||
@@ -23,7 +23,7 @@ defmodule CfHttp.MixProject do
|
||||
# Type `mix help compile.app` for more information.
|
||||
def application do
|
||||
[
|
||||
mod: {CfHttp.Application, []},
|
||||
mod: {FgHttp.Application, []},
|
||||
extra_applications: [:logger, :runtime_tools]
|
||||
]
|
||||
end
|
||||
@@ -1,4 +1,4 @@
|
||||
defmodule CfHttp.Repo.Migrations.CreateUsers do
|
||||
defmodule FgHttp.Repo.Migrations.CreateUsers do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
@@ -1,4 +1,4 @@
|
||||
defmodule CfHttp.Repo.Migrations.CreateDevices do
|
||||
defmodule FgHttp.Repo.Migrations.CreateDevices do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
@@ -1,4 +1,4 @@
|
||||
defmodule CfHttp.Repo.Migrations.CreateRules do
|
||||
defmodule FgHttp.Repo.Migrations.CreateRules do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
@@ -1,4 +1,4 @@
|
||||
defmodule CfHttp.Repo.Migrations.CreateSessions do
|
||||
defmodule FgHttp.Repo.Migrations.CreateSessions do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
@@ -5,7 +5,7 @@
|
||||
# Inside the script, you can read and write to any of your
|
||||
# repositories directly:
|
||||
#
|
||||
# CfHttp.Repo.insert!(%CfHttp.SomeSchema{})
|
||||
# FgHttp.Repo.insert!(%FgHttp.SomeSchema{})
|
||||
#
|
||||
# We recommend using the bang functions (`insert!`, `update!`
|
||||
# and so on) as they will fail if something goes wrong.
|
||||
6
apps/fg_http/test/fg_http/devices_test.exs
Normal file
6
apps/fg_http/test/fg_http/devices_test.exs
Normal file
@@ -0,0 +1,6 @@
|
||||
defmodule FgHttp.DevicesTest do
|
||||
use FgHttp.DataCase
|
||||
|
||||
describe "devices" do
|
||||
end
|
||||
end
|
||||
6
apps/fg_http/test/fg_http/rules_test.exs
Normal file
6
apps/fg_http/test/fg_http/rules_test.exs
Normal file
@@ -0,0 +1,6 @@
|
||||
defmodule FgHttp.RulesTest do
|
||||
use FgHttp.DataCase
|
||||
|
||||
describe "rules" do
|
||||
end
|
||||
end
|
||||
@@ -1,7 +1,7 @@
|
||||
defmodule CfHttpWeb.DeviceControllerTest do
|
||||
use CfHttpWeb.ConnCase
|
||||
defmodule FgHttpWeb.DeviceControllerTest do
|
||||
use FgHttpWeb.ConnCase
|
||||
|
||||
alias CfHttp.Devices
|
||||
alias FgHttp.Devices
|
||||
|
||||
@create_attrs %{name: "some name"}
|
||||
@update_attrs %{name: "some updated name"}
|
||||
@@ -1,5 +1,5 @@
|
||||
defmodule CfHttpWeb.RuleControllerTest do
|
||||
use CfHttpWeb.ConnCase
|
||||
defmodule FgHttpWeb.RuleControllerTest do
|
||||
use FgHttpWeb.ConnCase
|
||||
|
||||
describe "index" do
|
||||
end
|
||||
@@ -1,14 +1,14 @@
|
||||
defmodule CfHttpWeb.ErrorViewTest do
|
||||
use CfHttpWeb.ConnCase, async: true
|
||||
defmodule FgHttpWeb.ErrorViewTest do
|
||||
use FgHttpWeb.ConnCase, async: true
|
||||
|
||||
# Bring render/3 and render_to_string/3 for testing custom views
|
||||
import Phoenix.View
|
||||
|
||||
test "renders 404.html" do
|
||||
assert render_to_string(CfHttpWeb.ErrorView, "404.html", []) == "Not Found"
|
||||
assert render_to_string(FgHttpWeb.ErrorView, "404.html", []) == "Not Found"
|
||||
end
|
||||
|
||||
test "renders 500.html" do
|
||||
assert render_to_string(CfHttpWeb.ErrorView, "500.html", []) == "Internal Server Error"
|
||||
assert render_to_string(FgHttpWeb.ErrorView, "500.html", []) == "Internal Server Error"
|
||||
end
|
||||
end
|
||||
@@ -1,5 +1,5 @@
|
||||
defmodule CfHttpWeb.LayoutViewTest do
|
||||
use CfHttpWeb.ConnCase, async: true
|
||||
defmodule FgHttpWeb.LayoutViewTest do
|
||||
use FgHttpWeb.ConnCase, async: true
|
||||
|
||||
# When testing helpers, you may want to import Phoenix.HTML and
|
||||
# use functions such as safe_to_string() to convert the helper
|
||||
@@ -1,4 +1,4 @@
|
||||
defmodule CfHttpWeb.ChannelCase do
|
||||
defmodule FgHttpWeb.ChannelCase do
|
||||
@moduledoc """
|
||||
This module defines the test case to be used by
|
||||
channel tests.
|
||||
@@ -11,7 +11,7 @@ defmodule CfHttpWeb.ChannelCase do
|
||||
we enable the SQL sandbox, so changes done to the database
|
||||
are reverted at the end of every test. If you are using
|
||||
PostgreSQL, you can even run database tests asynchronously
|
||||
by setting `use CfHttpWeb.ChannelCase, async: true`, although
|
||||
by setting `use FgHttpWeb.ChannelCase, async: true`, although
|
||||
this option is not recommended for other databases.
|
||||
"""
|
||||
|
||||
@@ -25,15 +25,15 @@ defmodule CfHttpWeb.ChannelCase do
|
||||
use Phoenix.ChannelTest
|
||||
|
||||
# The default endpoint for testing
|
||||
@endpoint CfHttpWeb.Endpoint
|
||||
@endpoint FgHttpWeb.Endpoint
|
||||
end
|
||||
end
|
||||
|
||||
setup tags do
|
||||
:ok = Sandbox.checkout(CfHttp.Repo)
|
||||
:ok = Sandbox.checkout(FgHttp.Repo)
|
||||
|
||||
unless tags[:async] do
|
||||
Sandbox.mode(CfHttp.Repo, {:shared, self()})
|
||||
Sandbox.mode(FgHttp.Repo, {:shared, self()})
|
||||
end
|
||||
|
||||
:ok
|
||||
@@ -1,4 +1,4 @@
|
||||
defmodule CfHttpWeb.ConnCase do
|
||||
defmodule FgHttpWeb.ConnCase do
|
||||
@moduledoc """
|
||||
This module defines the test case to be used by
|
||||
tests that require setting up a connection.
|
||||
@@ -11,7 +11,7 @@ defmodule CfHttpWeb.ConnCase do
|
||||
we enable the SQL sandbox, so changes done to the database
|
||||
are reverted at the end of every test. If you are using
|
||||
PostgreSQL, you can even run database tests asynchronously
|
||||
by setting `use CfHttpWeb.ConnCase, async: true`, although
|
||||
by setting `use FgHttpWeb.ConnCase, async: true`, although
|
||||
this option is not recommended for other databases.
|
||||
"""
|
||||
|
||||
@@ -24,18 +24,18 @@ defmodule CfHttpWeb.ConnCase do
|
||||
# Import conveniences for testing with connections
|
||||
import Plug.Conn
|
||||
import Phoenix.ConnTest
|
||||
alias CfHttpWeb.Router.Helpers, as: Routes
|
||||
alias FgHttpWeb.Router.Helpers, as: Routes
|
||||
|
||||
# The default endpoint for testing
|
||||
@endpoint CfHttpWeb.Endpoint
|
||||
@endpoint FgHttpWeb.Endpoint
|
||||
end
|
||||
end
|
||||
|
||||
setup tags do
|
||||
:ok = Sandbox.checkout(CfHttp.Repo)
|
||||
:ok = Sandbox.checkout(FgHttp.Repo)
|
||||
|
||||
unless tags[:async] do
|
||||
Sandbox.mode(CfHttp.Repo, {:shared, self()})
|
||||
Sandbox.mode(FgHttp.Repo, {:shared, self()})
|
||||
end
|
||||
|
||||
{:ok, conn: Phoenix.ConnTest.build_conn()}
|
||||
@@ -1,4 +1,4 @@
|
||||
defmodule CfHttp.DataCase do
|
||||
defmodule FgHttp.DataCase do
|
||||
@moduledoc """
|
||||
This module defines the setup for tests requiring
|
||||
access to the application's data layer.
|
||||
@@ -10,7 +10,7 @@ defmodule CfHttp.DataCase do
|
||||
we enable the SQL sandbox, so changes done to the database
|
||||
are reverted at the end of every test. If you are using
|
||||
PostgreSQL, you can even run database tests asynchronously
|
||||
by setting `use CfHttp.DataCase, async: true`, although
|
||||
by setting `use FgHttp.DataCase, async: true`, although
|
||||
this option is not recommended for other databases.
|
||||
"""
|
||||
|
||||
@@ -20,20 +20,20 @@ defmodule CfHttp.DataCase do
|
||||
|
||||
using do
|
||||
quote do
|
||||
alias CfHttp.Repo
|
||||
alias FgHttp.Repo
|
||||
|
||||
import Ecto
|
||||
import Ecto.Changeset
|
||||
import Ecto.Query
|
||||
import CfHttp.DataCase
|
||||
import FgHttp.DataCase
|
||||
end
|
||||
end
|
||||
|
||||
setup tags do
|
||||
:ok = Sandbox.checkout(CfHttp.Repo)
|
||||
:ok = Sandbox.checkout(FgHttp.Repo)
|
||||
|
||||
unless tags[:async] do
|
||||
Sandbox.mode(CfHttp.Repo, {:shared, self()})
|
||||
Sandbox.mode(FgHttp.Repo, {:shared, self()})
|
||||
end
|
||||
|
||||
:ok
|
||||
2
apps/fg_http/test/test_helper.exs
Normal file
2
apps/fg_http/test/test_helper.exs
Normal file
@@ -0,0 +1,2 @@
|
||||
ExUnit.start()
|
||||
Ecto.Adapters.SQL.Sandbox.mode(FgHttp.Repo, :manual)
|
||||
@@ -1,21 +1,21 @@
|
||||
# CfVpn
|
||||
# FgVpn
|
||||
|
||||
**TODO: Add description**
|
||||
|
||||
## Installation
|
||||
|
||||
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
|
||||
by adding `cf_vpn` to your list of dependencies in `mix.exs`:
|
||||
by adding `fg_vpn` to your list of dependencies in `mix.exs`:
|
||||
|
||||
```elixir
|
||||
def deps do
|
||||
[
|
||||
{:cf_vpn, "~> 0.1.0"}
|
||||
{:fg_vpn, "~> 0.1.0"}
|
||||
]
|
||||
end
|
||||
```
|
||||
|
||||
Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
|
||||
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
|
||||
be found at [https://hexdocs.pm/cf_vpn](https://hexdocs.pm/cf_vpn).
|
||||
be found at [https://hexdocs.pm/fg_vpn](https://hexdocs.pm/fg_vpn).
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
defmodule CfVpn do
|
||||
defmodule FgVpn do
|
||||
@moduledoc """
|
||||
Documentation for `CfVpn`.
|
||||
Documentation for `FgVpn`.
|
||||
"""
|
||||
|
||||
@doc """
|
||||
@@ -8,7 +8,7 @@ defmodule CfVpn do
|
||||
|
||||
## Examples
|
||||
|
||||
iex> CfVpn.hello()
|
||||
iex> FgVpn.hello()
|
||||
:world
|
||||
|
||||
"""
|
||||
@@ -1,4 +1,4 @@
|
||||
defmodule CfVpn.Application do
|
||||
defmodule FgVpn.Application do
|
||||
# See https://hexdocs.pm/elixir/Application.html
|
||||
# for more information on OTP Applications
|
||||
@moduledoc false
|
||||
@@ -7,13 +7,13 @@ defmodule CfVpn.Application do
|
||||
|
||||
def start(_type, _args) do
|
||||
children = [
|
||||
# Starts a worker by calling: CfVpn.Worker.start_link(arg)
|
||||
# {CfVpn.Worker, arg}
|
||||
# Starts a worker by calling: FgVpn.Worker.start_link(arg)
|
||||
# {FgVpn.Worker, arg}
|
||||
]
|
||||
|
||||
# See https://hexdocs.pm/elixir/Supervisor.html
|
||||
# for other strategies and supported options
|
||||
opts = [strategy: :one_for_one, name: CfVpn.Supervisor]
|
||||
opts = [strategy: :one_for_one, name: FgVpn.Supervisor]
|
||||
Supervisor.start_link(children, opts)
|
||||
end
|
||||
end
|
||||
@@ -1,9 +1,9 @@
|
||||
defmodule CfVpn.MixProject do
|
||||
defmodule FgVpn.MixProject do
|
||||
use Mix.Project
|
||||
|
||||
def project do
|
||||
[
|
||||
app: :cf_vpn,
|
||||
app: :fg_vpn,
|
||||
version: "0.1.0",
|
||||
build_path: "../../_build",
|
||||
config_path: "../../config/config.exs",
|
||||
@@ -19,7 +19,7 @@ defmodule CfVpn.MixProject do
|
||||
def application do
|
||||
[
|
||||
extra_applications: [:logger],
|
||||
mod: {CfVpn.Application, []}
|
||||
mod: {FgVpn.Application, []}
|
||||
]
|
||||
end
|
||||
|
||||
8
apps/fg_vpn/test/fg_vpn_test.exs
Normal file
8
apps/fg_vpn/test/fg_vpn_test.exs
Normal file
@@ -0,0 +1,8 @@
|
||||
defmodule FgVpnTest do
|
||||
use ExUnit.Case
|
||||
doctest FgVpn
|
||||
|
||||
test "greets the world" do
|
||||
assert FgVpn.hello() == :world
|
||||
end
|
||||
end
|
||||
@@ -1,21 +1,21 @@
|
||||
# CfWall
|
||||
# FgWall
|
||||
|
||||
**TODO: Add description**
|
||||
|
||||
## Installation
|
||||
|
||||
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
|
||||
by adding `cf_wall` to your list of dependencies in `mix.exs`:
|
||||
by adding `fg_wall` to your list of dependencies in `mix.exs`:
|
||||
|
||||
```elixir
|
||||
def deps do
|
||||
[
|
||||
{:cf_wall, "~> 0.1.0"}
|
||||
{:fg_wall, "~> 0.1.0"}
|
||||
]
|
||||
end
|
||||
```
|
||||
|
||||
Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
|
||||
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
|
||||
be found at [https://hexdocs.pm/cf_wall](https://hexdocs.pm/cf_wall).
|
||||
be found at [https://hexdocs.pm/fg_wall](https://hexdocs.pm/fg_wall).
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
defmodule CfWall do
|
||||
defmodule FgWall do
|
||||
@moduledoc """
|
||||
Documentation for CfWall.
|
||||
Documentation for FgWall.
|
||||
"""
|
||||
|
||||
@doc """
|
||||
@@ -8,7 +8,7 @@ defmodule CfWall do
|
||||
|
||||
## Examples
|
||||
|
||||
iex> CfWall.hello()
|
||||
iex> FgWall.hello()
|
||||
:world
|
||||
|
||||
"""
|
||||
@@ -1,4 +1,4 @@
|
||||
defmodule CfWall.Application do
|
||||
defmodule FgWall.Application do
|
||||
# See https://hexdocs.pm/elixir/Application.html
|
||||
# for more information on OTP Applications
|
||||
@moduledoc false
|
||||
@@ -7,13 +7,13 @@ defmodule CfWall.Application do
|
||||
|
||||
def start(_type, _args) do
|
||||
children = [
|
||||
# Starts a worker by calling: CfWall.Worker.start_link(arg)
|
||||
# {CfWall.Worker, arg}
|
||||
# Starts a worker by calling: FgWall.Worker.start_link(arg)
|
||||
# {FgWall.Worker, arg}
|
||||
]
|
||||
|
||||
# See https://hexdocs.pm/elixir/Supervisor.html
|
||||
# for other strategies and supported options
|
||||
opts = [strategy: :one_for_one, name: CfWall.Supervisor]
|
||||
opts = [strategy: :one_for_one, name: FgWall.Supervisor]
|
||||
Supervisor.start_link(children, opts)
|
||||
end
|
||||
end
|
||||
@@ -1,9 +1,9 @@
|
||||
defmodule CfWall.MixProject do
|
||||
defmodule FgWall.MixProject do
|
||||
use Mix.Project
|
||||
|
||||
def project do
|
||||
[
|
||||
app: :cf_wall,
|
||||
app: :fg_wall,
|
||||
version: "0.1.0",
|
||||
build_path: "../../_build",
|
||||
config_path: "../../config/config.exs",
|
||||
@@ -19,7 +19,7 @@ defmodule CfWall.MixProject do
|
||||
def application do
|
||||
[
|
||||
extra_applications: [:logger],
|
||||
mod: {CfWall.Application, []}
|
||||
mod: {FgWall.Application, []}
|
||||
]
|
||||
end
|
||||
|
||||
8
apps/fg_wall/test/fg_wall_test.exs
Normal file
8
apps/fg_wall/test/fg_wall_test.exs
Normal file
@@ -0,0 +1,8 @@
|
||||
defmodule FgWallTest do
|
||||
use ExUnit.Case
|
||||
doctest FgWall
|
||||
|
||||
test "greets the world" do
|
||||
assert FgWall.hello() == :world
|
||||
end
|
||||
end
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user