Verified Commit 17f955c8 authored by Nicolas's avatar Nicolas

Remove Repo application

parent 336c2c32
......@@ -45,7 +45,7 @@ defmodule PlasmaRepo.Channels.Identifier do
def new(type, localpart, domain \\ nil) do
domain =
case domain do
nil -> PlasmaRepo.Application.domain()
nil -> PlasmaHS.Application.domain()
_ -> domain
end
......
defmodule PlasmaRepo.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
use Application
@domain Application.get_env(:plasma, :domain)
@system_username "__PLASMA__"
def start(_type, _args) do
# List all child processes to be supervised
children = [
{Horde.Registry, [name: Plasma.PlasmaRegistry, keys: :unique]},
{Horde.Supervisor,
[
name: PlasmaRepo.PlasmaSupervisor,
strategy: :one_for_one,
max_restarts: 100_000,
max_seconds: 1
]},
{Task.Supervisor, name: PlasmaRepo.TaskSupervisor},
PlasmaRepo.Events.EventTypeCache,
PlasmaRepo.Auth.AccessTokenCache,
# Start the Ecto repository
PlasmaRepo.Repo
]
# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: PlasmaRepo.Supervisor]
Supervisor.start_link(children, opts)
end
def domain() do
@domain
end
def system_user() do
PlasmaRepo.Channels.Identifier.new(:user, @system_username)
end
end
......@@ -5,6 +5,9 @@ defmodule PlasmaHS.Application do
use Application
@domain Application.get_env(:plasma, :domain)
@system_username "__PLASMA__"
def start(_type, _args) do
# List all child processes to be supervised
children = [
......@@ -42,4 +45,12 @@ defmodule PlasmaHS.Application do
:ok
end
def domain() do
@domain
end
def system_user() do
PlasmaRepo.Channels.Identifier.new(:user, @system_username)
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment