Scripting DSN and Mapping creation

Has anyone done any work with programmatically adding DSNs and Mappings to
the Lucee server admin from a command line? I’m in the process of setting
up a Vagrant box (forked from Mike Sprague’s project and updated to
CentOS/Apache) and am to the point that I need to configure the primary DSN
and set up 2 or 3 mappings.

I thought I had seen some discussion on doing this with Railo in the past
but I can’t seem to find that now.

Pointers to any resources would be appreciated.

Thanks
Dan

you can either use the cfadmin tag (see how we do it in the admin
implementation), or modify the xml files for lucee-server and/or lucee-web.

if you need it only on the application scope, then a better solution
might be to add it via the this.datasources and/or this.mappings of
Application.cfc

Igal Sapir
Lucee Core Developer
Lucee.org http://lucee.org/On 3/26/2015 10:26 AM, Dan Skaggs wrote:

Has anyone done any work with programmatically adding DSNs and
Mappings to the Lucee server admin from a command line? I’m in the
process of setting up a Vagrant box (forked from Mike Sprague’s
project and updated to CentOS/Apache) and am to the point that I need
to configure the primary DSN and set up 2 or 3 mappings.

I thought I had seen some discussion on doing this with Railo in the
past but I can’t seem to find that now.

Pointers to any resources would be appreciated.

Thanks
Dan

You received this message because you are subscribed to the Google
Groups “Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to lucee+unsubscribe@googlegroups.com
mailto:lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com
mailto:lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/055d27ad-39b6-4482-b35e-3a7996485674%40googlegroups.com
https://groups.google.com/d/msgid/lucee/055d27ad-39b6-4482-b35e-3a7996485674%40googlegroups.com?utm_medium=email&utm_source=footer.
For more options, visit https://groups.google.com/d/optout.

Actually what I wound up doing was going through the server admin to add
all the mappings and datasources that I need to populate a new VM with and
then copying the lucee-server.xml file out of the VM and into my Vagrant
project. The next time the a new VM is build with Vagrant, that file gets
copied back into the new VM and the settings were automatically there.

There are nearly 100 CF apps that could be running on this development VM
(depending on which of those you are working on) so editing the
Application.cfc for every one of them is not an option. These settings need
to be set up before any code ever runs.

Anyway, it’s all baked now…type ‘vagrant up’ and in just a few minutes we
get a CentOS/Apache/Lucee box that’s correctly configured and read to use
as a dev box.

Thanks
DanOn Thursday, March 26, 2015 at 2:29:13 PM UTC-4, Igal wrote:

I think that your simplest solution can be to put the settings in a file
(which you can generate with a script), and then include that file in
Application.cfc of the files that need it. consider the following example
(assuming all files in the same folder):

Application.cfc:
component {

this.name = "TEST150326_01";
include "appsettings.cfml";

}

appsettings.cfml: (defines mapping for /ram)

this.mappings[ “/ram” ] = “ram://”;

test.cfm: (test mapping with cffile and cfinclude)
<cffile action=“write” file=“ram://time.cfml” output=“#dump(var: now(),
label: “Time in Memory File”)#”>

you should be able to do the same for datasources, though I did not test
that.

Igal Sapir
Lucee Core Developer
Lucee.org http://lucee.org/
On 3/26/2015 10:59 AM, Dan Skaggs wrote:

Thanks Igal…

This is the primary DSN that all the apps use to dynamically create
their individual DSNs. As for the mappings, all applications share 3 core
mappings so I need to script those into the server admin so they’d be
automatically propagated to all web contexts.

I’ll check into the cfadmin tag and see what I can come up with. I might
be able to put a CFM page in the assets folder of the vagrant repo and hit
it with curl or something from within the vagrant script.

Thanks
Dan

On Thursday, March 26, 2015 at 1:33:00 PM UTC-4, Igal wrote:

you can either use the cfadmin tag (see how we do it in the admin
implementation), or modify the xml files for lucee-server and/or lucee-web.

if you need it only on the application scope, then a better solution
might be to add it via the this.datasources and/or this.mappings of
Application.cfc

Igal Sapir
Lucee Core Developer
Lucee.org http://lucee.org/
On 3/26/2015 10:26 AM, Dan Skaggs wrote:

Has anyone done any work with programmatically adding DSNs and Mappings
to the Lucee server admin from a command line? I’m in the process of
setting up a Vagrant box (forked from Mike Sprague’s project and updated to
CentOS/Apache) and am to the point that I need to configure the primary DSN
and set up 2 or 3 mappings.

I thought I had seen some discussion on doing this with Railo in the
past but I can’t seem to find that now.

Pointers to any resources would be appreciated.

Thanks
Dan

You received this message because you are subscribed to the Google Groups
“Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/055d27ad-39b6-4482-b35e-3a7996485674%40googlegroups.com
https://groups.google.com/d/msgid/lucee/055d27ad-39b6-4482-b35e-3a7996485674%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google Groups
“Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to lucee+un...@googlegroups.com <javascript:>.
To post to this group, send email to lu...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/dfa90589-2e17-44cc-83cc-83d01b7d2acb%40googlegroups.com
https://groups.google.com/d/msgid/lucee/dfa90589-2e17-44cc-83cc-83d01b7d2acb%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.