0

I wrote akka application in scala, application related properties also I kept it in application.conf along with akka config. I find it is logical place to keep properties.

If it is not good practice I would like to know reasoning behind it,
for example one of my property is akka.remote.receivers = [akka.ssl.tcp://remote-system@localhost:2222/user/receiver1]

How am I loading the properties?

  • Default properties I put it in reference.conf which exists in main/resources
  • application.conf loaded with fallback default.conf

1 Answers1

1

I think it is good to have a default.conf config as fallback along with your application.conf which is specific to deployment enviroments/machines.

Your reference.conf should have all the library (akka or any other library) defaults. Then your default.conf should have the application defaults (including defaults needed for business usecases if any). Your application.conf should override only needed properties from default.conf and reference.conf.

Also I believe that your default.conf should not override any reference.conf properties. Any overriding should be done in application.conf only. This helps make sure that you have only 1 place of overrides and you don't have to go through multiple places to see which conf overrides what.

Finally and most importantly:

Maintain consistency across apps/services/teams

In case you have multiple apps then make sure that you follow the decided process for all of them. It won't matter too much if you choose a bad way of using configs, but if you are in-consistent across your apps/services then its going to be a pain.

faizan
  • 578
  • 5
  • 14
  • So you are concluding that custom properties in `application.conf` is not a bad idea, isn't it? – Seeta Ramayya Vadali Aug 18 '16 at 11:07
  • 1
    @SeetaRamayyaVadali :Yes exactly, I think that is one of the roles of application.conf. I believe we just be consistent in our decided approach. – faizan Aug 19 '16 at 04:25