Cobenian / raygun

A raygun client for Elixir
Apache License 2.0
19 stars 15 forks source link

Raygun should not depend on Mix.Project #3

Closed barttenbrinke closed 9 years ago

barttenbrinke commented 9 years ago

https://github.com/Cobenian/raygun/blob/1f0afe1f7d7fc907c624f4db541455b631473bb3/lib/raygun/format.ex#L116-L129

If you are running your application in production using i.e. erts, mix is not included in your production build, therefore Mix.Project does not exist. Please remove it, or add mix as a dependency for the production environment, which would probably be a bad idea.

brweber2 commented 9 years ago

Yes, this was a bit sloppy/lazy on my part. Ideally we’d keep the details section, but I will remove the code that pull values via Mix. I may be able to get away with :application.get_env here, we’ll see.

If you have any other suggestions please send them my way either via a comment or pull request. Thanks!

On Sep 15, 2015, at 8:41 AM, Bart ten Brinke notifications@github.com wrote:

https://github.com/Cobenian/raygun/blob/1f0afe1f7d7fc907c624f4db541455b631473bb3/lib/raygun/format.ex#L116-L129 https://github.com/Cobenian/raygun/blob/1f0afe1f7d7fc907c624f4db541455b631473bb3/lib/raygun/format.ex#L116-L129 If you are running your application in production using i.e. erts, mix is not included in your production build, therefor Mix.Project does not exist. Please remove it, or add mix as a dependency for the production environment, which would probably not be good idea.

— Reply to this email directly or view it on GitHub https://github.com/Cobenian/raygun/issues/3.

barttenbrinke commented 9 years ago

I understand, but these variables just are not there anymore after compile time, :application.get_env will not help you here.

barttenbrinke commented 9 years ago

You could probably set these options as a class variable. That should save your original reference on compile time, so that you can use it after compile time.

brweber2 commented 9 years ago

Not these Mix values, but there are values that :application.get_key can use (such as :vsn). I hope to have a patch soon. :)

On Sep 15, 2015, at 9:04 AM, Bart ten Brinke notifications@github.com wrote:

I understand, but these variables just are not there anymore after compile time, :application.get_env will not help you here.

— Reply to this email directly or view it on GitHub https://github.com/Cobenian/raygun/issues/3#issuecomment-140381193.

brweber2 commented 9 years ago

Ok, I've released version 0.1.1 which should work as a release. I have the disksup stuff commented out for the moment, but I think that the rest should be working.

barttenbrinke commented 9 years ago

Mix values should be available at compile time, but as you are compiling to production, I'm not sure actually.

brweber2 commented 9 years ago

I tested with an exrm Phoenix release and it worked. Please let me know if you have any more issues with this. I will leave this open for a few days and then I'll close it if I don't hear back. Thanks.

barttenbrinke commented 9 years ago

@smeevil Fixed this for Honeybadger like this: https://github.com/smeevil/honeybadger-elixir/commit/63f6a1c29fbf7b701dd499095e5825c026959f57 Which should work fine for Raygun, @brweber2