Finish removing Omnibot.State functions

Omnibot.State shouldn't be used anywhere anymore except as a GenServer
being started up in the supervisor.

Also, configuration must be loaded through Config.load/1 rather than
being constructed, because everything expects a tuple of {plugin,
config} now.

Finally, Omnibot.Core must be added to the configuration in order for
basic functionality.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2020-08-11 15:23:53 -07:00
parent 2165167954
commit 2f378dd438
7 changed files with 110 additions and 102 deletions

View File

@@ -3,6 +3,7 @@ defmodule Omnibot.Supervisor do
use Supervisor
require IEx
alias Omnibot.Config
def start_link(opts) do
Supervisor.start_link(__MODULE__, :ok, opts)
@@ -10,10 +11,7 @@ defmodule Omnibot.Supervisor do
@impl true
def init(:ok) do
{_, bindings} = System.get_env("OMNIBOT_CFG", "omnibot.exs")
|> Code.eval_file()
cfg = bindings[:config]
cfg = System.get_env("OMNIBOT_CFG", "omnibot.exs") |> Config.load()
# TODO : move cfg to its own process so reloading it is as simple as killing the process
children = [