0

Is there a way to set the database config using environment variables that the host machine has set e.g.

<inline-jdbc pool-minsize="1" pool-maxsize="2"> <xa-properties user="{RDS_USERNAME}" password="{RDS_PASSWORD}" serverName="{RDS_HOSTNAME}" portNumber="{RDS_PORT}" databaseName="tenantcommon"/> </inline-jdbc>

This is so that I can commit the database settings without committing the database passwords etc, which is also very useful for CI, staging and production using the same database file but each of them having different environment variables?

Sam Hamilton
  • 131
  • 2
  • 3
  • 10

1 Answers1

0

The approach Moqui is designed for is to keep multiple runtime conf XML files, like variations on the MoquiStagingConf.xml and MoquiProductionConf.xml files. While these files can be in the runtime directory they don't have to be. In previous versions you had to use a ../foo/etc relative path for it to be outside the runtime dir, but now you can start the path with a forward slash to specify the full path to the runtime conf XML file.

You may have various other settings that vary by environment, more than just DB settings, so this approach handles all of them and you just have one runtime environment variable to set, the conf XML file to use.

David E. Jones
  • 1,721
  • 1
  • 9
  • 8
  • So right now there is no way to pass a environment variable into the XML that is picked up? I am really just trying to avoid adding passwords into git when building my Moqui docker. – Sam Hamilton Feb 16 '16 at 03:54
  • We could add special support for particular properties, i.e. look for them in the system properties instead of getting an attribute value from the XML file, but right now the answer is no there is nothing like that. – David E. Jones Mar 07 '16 at 06:06
  • That would be great. Right now the only difference between my staging and prod docker images is a database url and password. If those can be pushed into env then it would be super clean! – Sam Hamilton Mar 07 '16 at 06:08