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.EnvironmentProperty"> 
>   <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 [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