From ebbe27625ba2594bd71f2b48f0f38d67ed805c02 Mon Sep 17 00:00:00 2001 From: Nathan Perry Date: Tue, 28 Jan 2020 20:05:52 -0500 Subject: dotenv loading works --- apps/thulani_bot/lib/thulani/bot/application.ex | 1 + apps/thulani_bot/lib/thulani/bot/config.ex | 7 ++----- apps/thulani_bot/mix.exs | 3 +-- 3 files changed, 4 insertions(+), 7 deletions(-) (limited to 'apps/thulani_bot') diff --git a/apps/thulani_bot/lib/thulani/bot/application.ex b/apps/thulani_bot/lib/thulani/bot/application.ex index 63bd89e..8ab6e90 100644 --- a/apps/thulani_bot/lib/thulani/bot/application.ex +++ b/apps/thulani_bot/lib/thulani/bot/application.ex @@ -4,6 +4,7 @@ defmodule Thulani.Bot.Application do def start(_type, _args) do Config.init!() + Application.start(:nostrum) children = [] diff --git a/apps/thulani_bot/lib/thulani/bot/config.ex b/apps/thulani_bot/lib/thulani/bot/config.ex index 5542752..d93e8d1 100644 --- a/apps/thulani_bot/lib/thulani/bot/config.ex +++ b/apps/thulani_bot/lib/thulani/bot/config.ex @@ -11,7 +11,7 @@ defmodule Thulani.Bot.Config do require Logger - def init!() do + def init! do load_env() |> Enum.each(fn {application, vals} -> Enum.each(vals, fn {key, val} -> Application.put_env(application, key, val) end) @@ -22,9 +22,7 @@ defmodule Thulani.Bot.Config do end end - def load_env() do - if Application.get_env(:thulani, :env) == :dev, do: load_dotenv() - + def load_env do %{ nostrum: [ token: System.fetch_env!("THULANI_TOKEN"), @@ -54,5 +52,4 @@ defmodule Thulani.Bot.Config do {env_var, value} end) end - end diff --git a/apps/thulani_bot/mix.exs b/apps/thulani_bot/mix.exs index 13afa4f..9d3b6ae 100644 --- a/apps/thulani_bot/mix.exs +++ b/apps/thulani_bot/mix.exs @@ -24,8 +24,7 @@ defmodule Thulani.Bot.MixProject do defp deps do [ - # we look up the token based on an environment variable, so we can't do this - {:nostrum, "~> 0.4"}, + {:nostrum, "~> 0.4", runtime: false}, {:util, in_umbrella: true} ] end -- cgit v1.3.1