What is the best way to install and save your applications and these settings in ColdFusion?

I have parameters that I am setting now in ApplicationSettings.cfm and ThisSettings.cfm that I include in Application.cfc. I want to keep these options separate from the source code, because they contain environmental information. I currently gitignore these files and insert sample settings in the comments above, where I include them. Is there a better way to do this?

+4
source share
1 answer

There are two spring approaches.

  • we create the ApplicationSettings.cfm.template file and delete it in the original control, but ignore the real AplicationSettings.cfm file. Any developer who first gets the code will copy ApplicationSettings.cfm.template into ApplicationSettings.cfm and fix it.

  • another approach is to write code to read from the .properties file and place it outside of your code base. Therefore, the configuration files are clean. It also means that updating the code base in production is less error prone because the configuration is not in the same place as the code (we have hundreds of deployments, so this is very important to us). Our code base is read from .. /conf/config.properties, so it refers to the code base, but not in the same place. Here is a very simple example of setting properties for an application area from a properties file:

    var e=props.propertyNames() for(e=props.propertyNames();e.hasMoreElements(); ){ var key = e.nextElement(); application[key]=props.getProperty(key); } 
+4
source

Source: https://habr.com/ru/post/1434875/


All Articles