Checking if an application is running under Burrito
I want to be able to fetch arguments from my Application, regardless of if the application is being run from a burrito-based release or with mix. Ideally, I'd be able to do something like this
def get_args() do
if Burrito.is_standalone?() do
Burrito.Util.Args.get_argments()
else
System.argv()
end
end
Is there a way to do this that I'm not seeing? If not, consider this issue a feature request :)
I have the same issue as I support building with escript (which I use locally) and Burrito (which I intend for users).
I'm not aware of a built in way to do that so I currently solve this by passing an environment variable BUILD_MODE=[escript|burrito] to configure the project definition and how args are looked up.
I'm thinking of passing an extra env variable into the erlang launcher environment, something like __BURRITO=1 -- would that suffice?
I just released Burrito v1.0.3 to Hex! Now when a burrito app is launched, the environment variable __BURRITO will have the value 1. You can use this at runtime to check if your app is running inside burrito!