Charles Robertson
10/09/2024, 9:16 AM[refer to image attachment]
It seems that:
> { application.home }
Is referring to a variable of some sort?
Do you know where I would set a new placeholder variable, like:
> { application.dsnHost }
I have 300 DSNs and I don't want to change each one, every time I switch DB servers?
I have searched in:
\\wsl.localhost\Debian\opt\coldfusion2018\cfusion\runtime\conf\server.xml
\\wsl.localhost\Debian\opt\coldfusion2018\cfusion\runtime\conf\web.xml
But I cannot find anything?Rodney
10/09/2024, 12:40 PMJim Frankowski
10/09/2024, 1:01 PMRodney
10/09/2024, 1:02 PMMichael Schmidt
10/09/2024, 1:26 PMDave Merrill
10/09/2024, 1:27 PMCharles Robertson
10/09/2024, 1:30 PMjava.dsnHost=<http://foo.rds.co.uk|foo.rds.co.uk>
And then I added {application.dsnHost}
to the correct place, but the verification failed. So, clearly it didn’t work.
In the end, I just did a find/replace on the host name in `neo-datasources.xm`l and then swapped over the old file with the new file and everything works.
In future, I just need to switch between the two neo-datasources.xml
files to achieve what I need.
But thanks for the help everyone.
It would be really great, in a future release of Coldfusion, if they could add the following feature:
Add a section called CF Admin Variables, where we can set placeholder variables that can be used all over the CF Admin GUI 🙂Rodney
10/09/2024, 1:31 PMapplication.dnsHost=<http://foo.rds.co.uk|foo.rds.co.uk>
?Charles Robertson
10/09/2024, 3:07 PMjvm.config
file, use the java scope?Charles Robertson
10/09/2024, 3:08 PM#
# VM configuration
#
# Where to find JVM, if {java.home}/jre exists then that JVM is used
# if not then it must be the path to the JRE itself
java.home=/opt/coldfusion2018/jre
Charles Robertson
10/09/2024, 3:09 PMjava
scope is converted into the application
scope?Rodney
10/09/2024, 3:10 PMapplication.home=C:/ColdFusion2021/instance_name
just before Arguments to VM section.Charles Robertson
10/09/2024, 3:12 PMapplication.home=
Anywhere, in that file?Rodney
10/09/2024, 3:13 PMCharles Robertson
10/09/2024, 3:14 PMjava.home
Was being used, instead?Charles Robertson
10/09/2024, 3:17 PMapplication.home
Used in the Server Settings -> Java and JVM section of the Coldfusion Administrator GUI
So maybe, that java
scope is only picked up in that section and cannot be used in Data & Services sectionCharles Robertson
10/09/2024, 3:18 PMCharles Robertson
10/09/2024, 3:22 PMjava
scope does?Rodney
10/09/2024, 3:22 PMcfvonner
10/09/2024, 3:35 PMthis.datasources
in your Application.cfc
. You could set environment variables in your OS or in your jvm.config file to define the "global" variables, then access them when defining the datasources in Application.cfc
. This allows for having different values for the "global" variables on different servers (development/testing/staging/production) without having to alter your CFML code. Defining multiple datasources this way has been supported since CF 11.
Alternatively, as previously mentioned by @Michael Schmidt, you can use CommandBox and the CFConfig module to export/import the configuration settings that you typically use ColdFusion Administrator to manage. You could export just the database connections, edit them in a text editor, and then reimport them back into ColdFusion. This does not require you to use CommandBox to start/stop servers. You can use it just for this purpose if you want.bdw429s
10/09/2024, 6:26 PMbdw429s
10/09/2024, 6:26 PMbdw429s
10/09/2024, 6:27 PMbdw429s
10/09/2024, 6:27 PMbdw429s
10/09/2024, 6:27 PM