Loading config files from outside the mix project directory, is it possible?

It doesn’t seem like I can load config files via import_config that don’t live inside the mix project’s directory structure. Trying this in my config/config.exs file:

import_config “/var/local/git/poof-manager/config/base.exs”

…or this…

import_config “…/…/poof-manager/config/base.exs”

Gives me this error:

[root@poof.stirlab.local:/var/local/git/poof] # iex -S mix phx.server
Erlang/OTP 20 [erts-9.2] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:10] [hipe] [kernel-poll:false]

** (Mix.Config.LoadError) could not load config /var/local/git/poof-manager/config/base.exs
** (CompileError) /var/local/git/poof-manager/config/base.exs:1: undefined function config/3
(elixir) lib/code.ex:192: Code.eval_string/3
(mix) lib/mix/config.ex:188: Mix.Config.read!/2
(mix) lib/mix/config.ex:233: anonymous fn/3 in Mix.Config.read_wildcard!/2
(elixir) lib/enum.ex:1899: Enum."-reduce/3-lists^foldl/2-0-"/3
(stdlib) erl_eval.erl:670: :erl_eval.do_apply/6

This file exists and is readable:

[root@poof.stirlab.local:/var/local/git/poof] 1 # ls -al /var/local/git/poof-manager/config/base.exs
-rw-r–r-- 1 root root 422 Feb 22 22:27 /var/local/git/poof-manager/config/base.exs

Is there something I’m doing wrong w/ the syntax? Have I hit a limitation? If so, is there a reasonably clean workaround?

Do you have use Mix.Config at the very top of this file?

1 Like

Doh! That was it. Thanks for the pointer.