This commit is contained in:
Connor Rigby 2017-09-22 14:23:13 -07:00
parent d47c136fb1
commit 7a9117983e
6 changed files with 23 additions and 5 deletions

View file

@ -39,16 +39,20 @@ config :farmbot, :behaviour, [
firmware_handler: Farmbot.Firmware.StubHandler,
]
repos = [Farmbot.Repo.A, Farmbot.Repo.B, Farmbot.ConfigStorage]
repos = [Farmbot.Repo.A, Farmbot.Repo.B, Farmbot.System.ConfigStorage]
config :farmbot, ecto_repos: repos
for repo <- repos do
for repo <- [Farmbot.Repo.A, Farmbot.Repo.B] do
config :farmbot, repo,
adapter: Sqlite.Ecto2,
database: "#{repo}-#{env}.sqlite3",
priv: "priv/repo"
end
config :farmbot, Farmbot.System.ConfigStorage,
adapter: Sqlite.Ecto2,
database: "config-#{env}.sqlite3"
case target do
"host" -> import_config("host/#{env}.exs")
_ ->

View file

@ -31,4 +31,4 @@ config :farmbot, Farmbot.Repo.B,
priv: "priv/repo",
pool: Ecto.Adapters.SQL.Sandbox
config :farmbot, ecto_repos: [Farmbot.Repo.A, Farmbot.Repo.B]
config :farmbot, ecto_repos: [Farmbot.Repo.A, Farmbot.Repo.B, Farmbot.System.ConfigStorage]

View file

@ -0,0 +1,4 @@
defmodule Farmbot.System.ConfigStorage do
@moduledoc "Repo for storing config data."
use Ecto.Repo, otp_app: :farmbot, adapter: Sqlite.Ecto2
end

View file

@ -12,8 +12,9 @@ defmodule Farmbot.System.Supervisor do
def init(args) do
:farmbot
|> Application.get_env(:init)
|> Application.get_env(:init)
|> Enum.map(fn(child) -> fb_init(child, [args, [name: child]]) end)
|> Kernel.++([supervisor(Farmbot.System.ConfigStorage, [])])
|> supervise([strategy: :one_for_all])
end
end

View file

@ -1,4 +1,5 @@
%{"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [], [], "hexpm"},
%{"base64url": {:hex, :base64url, "0.0.1", "36a90125f5948e3afd7be97662a1504b934dd5dac78451ca6e9abf85a10286be", [], [], "hexpm"},
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [], [], "hexpm"},
"certifi": {:hex, :certifi, "2.0.0", "a0c0e475107135f76b8c1d5bc7efb33cd3815cb3cf3dea7aefdd174dabead064", [], [], "hexpm"},
"combine": {:hex, :combine, "0.10.0", "eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f", [], [], "hexpm"},
"connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [], [], "hexpm"},
@ -23,6 +24,7 @@
"httpoison": {:hex, :httpoison, "0.13.0", "bfaf44d9f133a6599886720f3937a7699466d23bb0cd7a88b6ba011f53c6f562", [], [{:hackney, "~> 1.8", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm"},
"idna": {:hex, :idna, "5.1.0", "d72b4effeb324ad5da3cab1767cb16b17939004e789d8c0ad5b70f3cea20c89a", [], [{:unicode_util_compat, "0.3.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm"},
"jsx": {:hex, :jsx, "2.8.2", "7acc7d785b5abe8a6e9adbde926a24e481f29956dd8b4df49e3e4e7bcc92a018", [], [], "hexpm"},
"jwt": {:hex, :jwt, "0.1.3", "fda326d06a88c75cdfc58ee64516eddd100138082e99e26ed38bffb600422a9e", [], [{:base64url, "0.0.1", [hex: :base64url, repo: "hexpm", optional: false]}, {:jsx, "2.8.0", [hex: :jsx, repo: "hexpm", optional: false]}], "hexpm"},
"meck": {:hex, :meck, "0.8.8", "eeb3efe811d4346e1a7f65b2738abc2ad73cbe1a2c91b5dd909bac2ea0414fa6", [], [], "hexpm"},
"metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [], [], "hexpm"},
"mime": {:hex, :mime, "1.1.0", "01c1d6f4083d8aa5c7b8c246ade95139620ef8effb009edde934e0ec3b28090a", [], [], "hexpm"},

View file

@ -0,0 +1,7 @@
defmodule Farmbot.System.ConfigStorage.Migrations.AddEAVTable do
use Ecto.Migration
def change do
end
end