Use fake app in Mix.Config.config/2?

I have an app, let’s call it foo, and it has some support code, let’s say that’s in lib/foo/manager. The stuff in lib/foo/manager doesn’t really belong in its own app, but I’d like have a namespace for it in my config, like so:

use Mix.Config
config :foo, :bar, "baz"
config :foo_manager, :bing, "bang"

However, when I try that, I get this error upon startup:

You have configured application :foo_manager in your configuration file,
but the application is not available.

This usually means one of:

  1. You have not added the application as a dependency in a mix.exs file.

  2. You are configuring an application that does not really exist.

Please ensure :poof_manager exists or remove the configuration.

…and for the life of me I can’t find a reasonable way to convince mix that I don’t care that :foo_manager isn’t a real module.

I’d even settle for a reasonably clean way to fake the application. Does anyone have a workaround for me?

Configuration is tied to applications. When you build a release there won’t be a :foo_manager application so its config won’t be included in the release. The general convention is to do:

config :foo, :manager,
  bing: "bang"
2 Likes

Seems best to surrender then. I don’t really want to go a layer deeper in my keys, though, so I’ll go the prefix route:

use Mix.Config
config :foo, :bar, "baz"
config :foo, :manager_bing, "bang"

Thanks for the clarification.