I can't figure out how to automatically start an "deps" applciation in Chicago Boss.
Use applcation:which_applications()
I can see a bunch started like "lager, ranch, cowboy ..etc etc". How do I start another one I added?
If I go to console and run application:start(oauth2)
and it's ok. I can start it.
But I tried to change src/xxx.app.src
and add it to {applications,[]}
, but no go. Isn't this the place to load/start any application that mine depends on?
But I can't find how boss loads and start all the other applications either.
By the way, this oauth2 appliation doesn't contain an application-behavior file (oauth2_app.erl) so I don't know if this is related. Since I can manually start it ok.
So, confused. Any help would be appreciated.
Plus: I remember that I did start application by adding the application:start(xxx)
into the /priv/init/xxx_01_news.erl
init
function but that's very hackish I think.
You can use rebar.config
to add your dependency applications then edit boss.config
file this way:
applications
.boss.config file:
[
{boss, [
{path, "./deps/boss"},
{applications, [your_app_name, your_app_dep_1, your_app_dep_2]},
{assume_locale, "en"},
%% ... other configuration
%% APPLICATION CONFIGURATIONS
{your_app_name, []},
{your_app_dep_1, []},
{your_app_dep_2, []}
].
Edit: This way CB expects another boss application so looks for the router file and warns if cannot find it. However starting the dependencies inside its init
function is not a dirty way and I suggest to consider it.