michalmuskala / plug_attack

A plug building toolkit for blocking and throttling abusive requests
419 stars 21 forks source link

Dependency declaration required in the root of an umbrella app as well? #10

Closed mariusbutuc closed 7 years ago

mariusbutuc commented 7 years ago

An umbrella app has one application that uses PlugAttack and has it declared as a dependency in its mix file. ๐Ÿ‘

Starting an iex session from the inner app behaves as expected, but when starting it from the root level of the umbrella app this feedback is provided:

$ iex -S mix
Erlang/OTP 20 [erts-9.0] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false]

You have configured application PlugAttack 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 PlugAttack exists or remove the configuration.

Interactive Elixir (1.4.5) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)>

Does PlugAttack need to be added as a dependency in the root mix.exs file?

Fairly new to plugs, and sure where to start debugging this. Any pointers would be appreciated!

michalmuskala commented 7 years ago

That message is usually printed when you have code like config app and the app does not exist. PlugAttack does not have any config, though, so it looks really wired. Can you show your config files?

mariusbutuc commented 7 years ago

Oh, thanks Michaล‚: in the config for the :api app, it seems to have been an issue of having

config PlugAttack,
  throttle_period: 1_000,
  attempts_per_period: 60

instead of

config :api, PlugAttack,
  throttle_period: 1_000,
  attempts_per_period: 60

๐Ÿ‘