Hi Will -

It should automatically pick up the correct ${dsn} value from your config 
file, and it sounds like you're using CS 1.2.

The only other thing I can possibly think of is the hyphen in your 
environment names. I really doubt this is it, but if the environment names 
are somehow being evaluated along the way, CF could be trying to evaluate 
two variables rather than treating it as a string. I really doubt this is 
it, but you could try that.

Also - have you checked to make sure that any other properties in your 
environment config are being propagated down into the rest of your Mach-II 
app? It could be an issue with environmentConfig as a whole, and not just 
CS. Probably worthwhile to eliminate any other possible problems.

brian


On Wednesday, April 25, 2012 9:31:43 AM UTC-4, Will Yu wrote:
>
> Brian,
>
> I'm not sure but based from the frameworkProperties.properties file it say 
> the "majorVersion=1.2"  So assume it's not 2.0 but I could be wrong.
>
> So are you saying that the <value>${dsn}</value> "should" automatically 
> pick up my dsn value from my config file, if I'm not using CS 2.0?  I do 
> apologize I'm dragging this thread on and on I figured it would be a simple 
> solution to this matter and I was missing something on my end.
>
> Thanks,
> Will
>
> On Wed, Apr 25, 2012 at 9:12 AM, Brian Klaas <[email protected]>wrote:
>
>> Will - are you using ColdSpring 2.0 by any chance? I'm not sure if the 
>> Mach-II ColdSpring property works with CS 2.0 just yet. Jason, Peter or 
>> Kurt might know if the current CS property is compatible with CS 2.0.
>>
>> I do know that if you have all the nodes in your environment config XML 
>> file, set the dsn value in your environment config file, and you're using 
>> the ColdSpring property, it does work. It's used in all of our production 
>> apps.
>>
>> brian
>>
>>
>> On Tuesday, April 24, 2012 10:13:05 AM UTC-4, Will Yu wrote:
>>>
>>> Jason,
>>>
>>> Thanks for the suggestion I'll definitely give it a try.  Just to be 
>>> clear I do have all the nodes you've given as an example as well as the 
>>> nodes mentioned by Brian.  I just didn't include it in my entry.  To be 
>>> clear my I believe I understand the config file well enough to have my 
>>> application running, BUT with the exception to my coldspring.xml file.
>>>
>>> As you know I have all these environments for my project but I don't 
>>> want to be in the business of having a different mach-ii.xml file different 
>>> on each of my environment because I'm defining <property name="dsn" 
>>> value="some_datasource" /> just so my coldspring.xml file can pick up the 
>>> <value>${dsn}</value> parameter.  I don't believe that makes my code 
>>> portable.  My goal is to be able to put this code on any server and with no 
>>> changes, because the logic is there already to determine the environments.
>>>
>>> So the question what's the <value>${????}</value> do I need to be placed 
>>> into my coldspring.xml file so it will dynamically pick up the proper dsn 
>>> from my environment nodes?  I know the framework itself knows the proper 
>>> dsn, because when I do a getProperty("dsn") call it pulls the correct 
>>> information but I can't seem to find the correct variable for my 
>>> coldspring.xml file.
>>>
>>> Thanks in advance for all that have already replied and I would greatly 
>>> appreciate any more clarification.
>>>
>>> Will 
>>>
>>> On Tue, Apr 24, 2012 at 9:40 AM, jason.york <[email protected]>wrote:
>>>
>>>> Hi Will,
>>>>
>>>> One thing I noticed is that you're missing end quotes after your 
>>>> environment names.. eg "dev-main
>>>>
>>>> Also you may want to consider using the default environments (local, 
>>>> test, qa, stage, prod) I think those names have special meaning to Mach-ii.
>>>>
>>>> You're also missing the <parameters> tag.  So If I were to rewrite your 
>>>> code, it would look something like:
>>>>
>>>> <property name="environment" type="MachII.properties.**
>>>> EnvironmentProperty">
>>>>     <parameters>
>>>>         <parameter name="defaultEnvironmentName" value="local" />
>>>>
>>>>         <parameter name="local">
>>>>
>>>>             <struct>
>>>>                 <key name="properties">
>>>>                     <struct>
>>>>                         <key name="dsn" value="datasource1" />
>>>>                     </struct>
>>>>                 </key>
>>>>             </struct>
>>>>         </parameter>
>>>>         <parameter name="test">
>>>>             <struct>
>>>>                 <key name="properties">
>>>>                     <struct>
>>>>                         <key name="dsn" value="datasource2" />
>>>>                     </struct>
>>>>                 </key>
>>>>             </struct>
>>>>         </parameter>        
>>>>         <parameter name="prod">
>>>>
>>>>             <struct>
>>>>                 <key name="properties">
>>>>                     <struct>
>>>>                         <key name="dsn" value="datasource2" />
>>>>                     </struct>
>>>>                 </key>
>>>>             </struct>
>>>>         </parameter>        
>>>>     </parameters>
>>>> </property>
>>>>
>>>> Hope that helps!
>>>>
>>>> -- Jason
>>>>
>>>> On Monday, April 23, 2012 1:49:55 PM UTC-5, Will Yu wrote:
>>>>>
>>>>> Hello, 
>>>>>
>>>>> I'm definitely very new to Mach-II and I'm experiencing some 
>>>>> difficulties on how to pull the proper ${dsn} variable from a Multiple 
>>>>> Environment settings in my config file.  My development, testing and 
>>>>> production all have different DSN variable names/values.  It looks 
>>>>> like my config file is setup properly because my application starts up 
>>>>> and runs with no problem, but only when I define <property name="dsn" 
>>>>> value="datasource_name" />.  The coldspring.xml references the 
>>>>> <value>$ 
>>>>> {dsn}</value> and is able to pull this info. 
>>>>>
>>>>> BUT I want to delete that <property> tag and use the "Environment 
>>>>> Settings" listed below: 
>>>>>
>>>>> <property name="environment" 
>>>>> type="MachII.properties.**Enviro**nmentProperty"> 
>>>>>   <parameter name="dev-main> 
>>>>>     <struct> 
>>>>>       <key name="properties"> 
>>>>>         <struct> 
>>>>>           <key name="dsn" value="datasource1" /> 
>>>>>         </struct> 
>>>>>       </key> 
>>>>>     </struct> 
>>>>>   </parameter> 
>>>>>   <parameter name="test-main> 
>>>>>     <struct> 
>>>>>       <key name="properties"> 
>>>>>         <struct> 
>>>>>           <key name="dsn" value="datasource2" /> 
>>>>>         </struct> 
>>>>>       </key> 
>>>>>     </struct> 
>>>>>   <parameter name="production-main> 
>>>>>     <struct> 
>>>>>       <key name="properties"> 
>>>>>         <struct> 
>>>>>           <key name="dsn" value="datasource2" /> 
>>>>>         </struct> 
>>>>>       </key> 
>>>>>     </struct> 
>>>>>   </parameter> 
>>>>>   </parameter> 
>>>>> </property> 
>>>>>
>>>>> What variable do I put in my coldspring.xml file so it knows which 
>>>>> datasource to pull from depending on the environment it is in?  ${dsn} 
>>>>> does not work within this file but when I do getProperty("dsn") it 
>>>>> pulls the correct dsn value? 
>>>>>
>>>>> Thanks, 
>>>>> Will
>>>>
>>>>  -- 
>>>> To post to this group, send email to mach-ii-for-coldfusion@**
>>>> googlegroups.com <[email protected]>
>>>> For more options and to unsubscribe, visit this group at 
>>>> http://groups.google.com/**group/mach-ii-for-coldfusion?**hl=en<http://groups.google.com/group/mach-ii-for-coldfusion?hl=en>
>>>>  
>>>> SVN: http://svn.mach-ii.com/machii/
>>>> Wiki / Documentation / Tickets: 
>>>> http://trac.mach-ii.com/**machii/<http://trac.mach-ii.com/machii/>
>>>>
>>>
>>>  -- 
>> To post to this group, send email to 
>> [email protected]
>> For more options and to unsubscribe, visit this group at 
>> http://groups.google.com/group/mach-ii-for-coldfusion?hl=en
>>  
>> SVN: http://svn.mach-ii.com/machii/
>> Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/
>>
>
>

-- 
To post to this group, send email to [email protected]
For more options and to unsubscribe, visit this group at 
http://groups.google.com/group/mach-ii-for-coldfusion?hl=en

SVN: http://svn.mach-ii.com/machii/
Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/

Reply via email to