Curious @Kurisu, do you have a bit more context around this issue? Are you only trying to run a Task in production? I think having a bit more detail / context around your problem could even help people who are answering the question.
In general, in most Elixir codebases (at least the ones I’ve seen), people tend to set environment specific config values (e.g., for API keys - sandbox and production) when the environment makes a difference rather than calling Mix.env directly.
@treble37
Here the context… In dev environment I configured Arc uploader to store pictures on local disk, but in production on a storage like Amazon S3. So to delete a file in dev mode, I’m using « File.rm_rf!/1 » but this won’t work wiith S3 (I will use Arc deleting funtion for this case).
@NobbZ
Thank you. I did well by asking the question then. ^^
Maybe… I just found it easier some times ago to delete the files from the local disk with my own function when in dev environment…
I will try again the Arc delete function in dev with local storage and if it works as expected, then good!
If arc does not handle it correctly, it’s worth a bug report in my opinion, as in a good API those functions should be totally agnostic to the actual storing backend.
I feel like I’m proposing an immediate solution to other people’s immediate problems. They can use it until, as you suggested above, arc fixes this “bug”. And, as always, other users are free to suggest more idiomatic approaches if they don’t agree with me. There is zero reason to not be happy about it.
It’s good to know I can even do something like that! ^^
I understand too, the way I should use configs…
Finally I have to say that Arc function for files deletion works. I just have not to store files in subfolders because Arc would let plenty empty folders after deletion. I was using subfolders so I can delete all versions of a picture by deleting a subfolder, but Arc delete them one by one and let an empty subfolder.
I almost never see this sentiment actually working in practice. People code something, ugly hack or not, check that it works, and they never touch it again.