Skip to content

Commit

Permalink
Modified readme to remove HTML comments
Browse files Browse the repository at this point in the history
  • Loading branch information
adam oneil committed Feb 8, 2017
1 parent 065a98a commit aae142b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
37 changes: 20 additions & 17 deletions README.md
@@ -1,19 +1,21 @@
<h1>dotnetconfig Cookbook</h1>
<h2>.NET configuration file editor. Provides functionality to update a .NET app / web configuration file with values from a chef run.</h2>
dotnetconfig Cookbook
=====================

<p>WORK IN PROGRESS - Currently in Alpha, feel free to test it out but don't use in production until this message is removed or we have hit V1.0.0.</p>
##NET configuration file editor. Provides functionality to update a .NET app / web configuration file with values from a chef run.

<h3>Open the file for editing, non locking</h3>
WORK IN PROGRESS - Currently in Alpha, feel free to test it out but don't use in production until this message is removed or we have hit V1.0.0.

##Open the file for editing, non locking
```ruby
documentPath = 'C:\\Config\\' + 'app.config'
document = config_getxml(documentPath)
```

<h3>Set app settings within the config file</h3>
<p>Arguments:</p>
<p> Document: Pass document which was fetched from config_getxml</p>
<p> SettingName: The setting to update</p>
<p> SettingValue: The new value to apply to the configuration</p>
##Set app settings within the config file<
Arguments:
Document: Pass document which was fetched from config_getxml
SettingName: The setting to update
SettingValue: The new value to apply to the configuration

```ruby
config_set_app_setting(document, 'fix-gateways', 'Replaced')
Expand All @@ -24,8 +26,8 @@ config_set_app_setting(document, 'default-version', 'Edit5')
config_set_app_setting(document, 'fix-service-test-file-name', 'Edit6')
```

<h3>Setting custom elements</h3>
<p>Set an element's content using an xPath query, Example:</p>
##Setting custom elements
Set an element's content using an xPath query, Example:

```xml
<custom>
Expand All @@ -36,33 +38,34 @@ config_set_app_setting(document, 'fix-service-test-file-name', 'Edit6')
</custom>
```

<p>This block would find the first occurrence of the 'custom' element and set the content of each of its elements to a new value.</p>
This block would find the first occurrence of the 'custom' element and set the content of each of its elements to a new value.
```ruby
config_set_element_content(document, '//configuration/custom/user', 'Edit8')
config_set_element_content(document, '//configuration/custom/password', 'Edit9')
config_set_element_content(document, '//configuration/custom/host', 'Edit10')
config_set_element_content(document, '//configuration/custom/port', 'Edit11')
```

<h3>Setting the content of a specific element using xPath</h3>
<p>This would find the first log4net appender called MyAppender</p>
##Setting the content of a specific element using xPath
This would find the first log4net appender called MyAppender
```ruby
config_set_element_content(document, '//configuration/log4net/appender[@name="MyAppender"]/hostName', 'NewValue1')
config_set_element_content(document, '//configuration/log4net/appender[@name="MyAppender"]/userName', 'NewValue2')
config_set_element_content(document, '//configuration/log4net/appender[@name="MyAppender"]/password', 'NewValue3')
```

<h3>Set the the entire content of a connection string</h3>
##Connection strings
Set the the entire content of a connection string
```ruby
config_set_connection_string(document, 'Database1', 'Database=Partial;User Id=Replacement;Password=PasswordChanged;CommandTimeout=30;MinPoolSize=0')
```

<h3>Set an individual property within a connection string</h3>
Set an individual property within a connection string
```ruby
config_set_connection_string_property(document, 'Database2', 'password', 'NewValue123654')
```

<h3>Saving changes made to the file</h3>
Saving changes made to the file
```ruby
config_writexml(document, outputPath)
```
2 changes: 1 addition & 1 deletion metadata.rb
Expand Up @@ -4,7 +4,7 @@
license 'All rights reserved'
description 'Installs/Configures dotnetconfig'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.2.1'
version '0.2.3'

#Cookbook dependencies - Nokogiri
depends 'nokogiri'
Expand Down

0 comments on commit aae142b

Please sign in to comment.