Skip to content

Commit

Permalink
fix: remove mix env check (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikFerrari authored Jul 11, 2023
1 parent cc520dc commit 9cb8780
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions lib/arke_postgres.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ defmodule ArkePostgres do
alias ArkePostgres.{Table, ArkeUnit}

def init() do
case check_env(Mix.env()) do

case check_env() do
{:ok, nil} ->
try do
projects =
Expand Down Expand Up @@ -49,9 +50,7 @@ defmodule ArkePostgres do

def print_missing_env(keys), do: print_missing_env([keys])

def check_env(:test), do: {:ok, nil}

def check_env(_env) do
def check_env() do
keys = ["DB_NAME", "DB_HOSTNAME", "DB_USER", "DB_PASSWORD"]

key_map =
Expand Down
2 changes: 1 addition & 1 deletion lib/mix/tasks/arke_postgres.create_project.ex
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ defmodule Mix.Tasks.ArkePostgres.CreateProject do
end

def run(args) do
case ArkePostgres.check_env(Mix.env()) do
case ArkePostgres.check_env() do
{:ok, _} ->
[:postgrex, :ecto_sql, :arke]
|> Enum.each(&Application.ensure_all_started/1)
Expand Down
2 changes: 1 addition & 1 deletion lib/mix/tasks/arke_postgres.init_db.ex
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ defmodule Mix.Tasks.ArkePostgres.InitDb do
def run(args) do
{opts, _} = OptionParser.parse!(args, strict: @switches, aliases: @aliases)

case ArkePostgres.check_env(Mix.env()) do
case ArkePostgres.check_env() do
{:ok, _} ->
[:postgrex, :ecto_sql, :arke_auth, :arke]
|> Enum.each(&Application.ensure_all_started/1)
Expand Down

0 comments on commit 9cb8780

Please sign in to comment.