Le 2015-09-23 12:09, Andrew Hodgson a écrit :
This one (with no clue from where comes the tokens... so hard to really compare)
<connectionStrings>
<add name="MyConnectionString" connectionString="Data Source=__AppDBServer__;Initial Catalog=__AppDatabase__;User ID=__AppDBUserID__;Password=__AppDBPassword__" providerName="System.Data.SqlClient" /> </connectionStrings> Vs a template named Web.config.erb
<connectionStrings>
<add name="MyConnectionString" connectionString="Data Source=<%= @params['AppDBServer'] %>;Initial Catalog=<%= @params['AppDatabase'] %>;User ID=<%= @params['AppDBUserID'] %>;Password=<%= @params['AppDBPassword'] %>" providerName="System.Data.SqlClient" /> </connectionStrings> For a template resource being:
template "path/to/Web.config" do
source "Web.config.erb"
variables( :params => data_bag_item('AppSqlInfo',node.chef_environment )
end
And a databag 'AppSqlInfo' with an item for each environment containing a hash like this:
{ :AppDBServer => "Server",
:AppDatabase => "DbName",
:AppDBUserId => "User",
:AppDBPassword => "password
}
What do you find complex there ?
From my window the templates structure is nearly the same (<%= var %> instead of __var__), and according to the doc I read on xTokenize, you'll have to build the hash file or to distribute one according to the environment too...
I would really like to get your feedback on what you find more complex in this approach than the xTokenize one
|
Archive powered by MHonArc 2.6.16.