2

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.

Hao
  • 6,291
  • 9
  • 39
  • 88

1 Answers1

0

You can use rebar.config to add your dependency applications then edit boss.config file this way:

  • First: Add the dependency applications name in applications.
  • Second: Add their specific configurations as follows.

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.

Hamidreza Soleimani
  • 2,504
  • 16
  • 19
  • It works. But the console has error "missing or invalid boss.routes file in "deps/oauth2/priv/boss.routes" {error, enoent}. It seems expecting a boss application. – Hao Jan 18 '16 at 14:47
  • @Jusfeel Yes it expects another boss application so looks for the router file. However starting the dependencies inside the `init` function is not a dirty way and I suggest to consider it. I edited the answer with this. – Hamidreza Soleimani Jan 18 '16 at 18:47