Site updated at 2016-08-28 17:05:28 UTC

This commit is contained in:
Travis CI 2016-08-28 17:05:28 +00:00
parent b9e6e98d2b
commit 8d4505d32c
28 changed files with 121 additions and 75 deletions

View file

@ -91,11 +91,11 @@
<hr class="divider">
<p>The <code class="highlighter-rouge">configuration.yaml</code> file a plain-text file thus it is readable for everyone who has access to the file. The file contains passwords and API tokens which need to be redacted if you want to share your configuration. This separation can also help you to keep easier track of your passwords and API keys (as they are all stored at one place and no longer spread across the <code class="highlighter-rouge">configuration.yaml</code> file) if you dont want to <a href="/topics/splitting_configuration/">split up your configuration</a>.</p>
<p>The <code class="highlighter-rouge">configuration.yaml</code> file is a plain-text file, thus it is readable by anyone who has access to the file. The file contains passwords and API tokens which need to be redacted if you want to share your configuration. By using <code class="highlighter-rouge">!secrets</code> you can remove any private information from you configuration files. This separation can also help you to keep easier track of your passwords and API keys. As they are all stored at one place and no longer spread across the <code class="highlighter-rouge">configuration.yaml</code> file or even multiple yaml files if you <a href="/topics/splitting_configuration/">split up your configuration</a>.</p>
<h3><a class="title-link" name="using-secretsyaml" href="#using-secretsyaml"></a> Using secrets.yaml</h3>
<p>The workflow for the outsourcing in the <code class="highlighter-rouge">secrets.yaml</code> is very similar to the <a href="/topics/splitting_configuration/">splitting of the configuration</a>. Create a <code class="highlighter-rouge">secrets.yaml</code> file in your Home assistant configuration directory (The location of the folder differs between operating systems: on OS X and Linux its <code class="highlighter-rouge">~/.homeassistant</code> and on Windows its <code class="highlighter-rouge">%APPDATA%/.homeassistant</code>).</p>
<p>The workflow for moving private information to <code class="highlighter-rouge">secrets.yaml</code> is very similar to the <a href="/topics/splitting_configuration/">splitting of the configuration</a>. Create a <code class="highlighter-rouge">secrets.yaml</code> file in your Home assistant configuration directory (The location of the folder differs between operating systems: on OS X and Linux its <code class="highlighter-rouge">~/.homeassistant</code> and on Windows its <code class="highlighter-rouge">%APPDATA%/.homeassistant</code>).</p>
<p>The entries for password and API keys in the <code class="highlighter-rouge">configuration.yaml</code> file usually looks like the example below.</p>
@ -113,11 +113,33 @@
<p>The <code class="highlighter-rouge">secrets.yaml</code> file contains the corresponding password assigned to the identifier.</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">logger</span><span class="pi">:</span> <span class="s">debug</span>
<span class="s">http_password</span><span class="pi">:</span> <span class="s">YOUR_PASSWORD</span>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">http_password</span><span class="pi">:</span> <span class="s">YOUR_PASSWORD</span>
</code></pre>
</div>
<h3><a class="title-link" name="debugging-secrets" href="#debugging-secrets"></a> Debugging secrets</h3>
<p>When you start splitting your configuration into multiple files, you might end up with configuration in sub folders. Secrets will be resolved in this order:</p>
<ul>
<li>A <code class="highlighter-rouge">secrets.yaml</code> located in the same folder as the yaml file referencing the secret,</li>
<li>next, parent folders will be searched for a <code class="highlighter-rouge">secrets.yaml</code> file with the secret, stopping at the folder with the main <code class="highlighter-rouge">configuration.yaml</code>,</li>
<li>lastly, <code class="highlighter-rouge">keyring</code> will be queried for the secret (more info below)</li>
</ul>
<p>To see where secrets are being loaded from you can either add an option to your <code class="highlighter-rouge">secrets.yaml</code> file or use the <code class="highlighter-rouge">check_config</code> script.</p>
<p><em>Option 1</em>: Print where secrets are retrieved from to the Home Assistant log by adding the following to <code class="highlighter-rouge">secrets.yaml</code>:</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">logger</span><span class="pi">:</span> <span class="s">debug</span>
</code></pre>
</div>
<p>This will not print the actual secrets value to the log.</p>
<p><em>Option 2</em>: View where secrets are retrieved from and the contents of all <code class="highlighter-rouge">secrets.yaml</code> files used, you can use the <code class="highlighter-rouge">check_config</code> script from the command line:</p>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code>hass --script check_config --secrets
</code></pre>
</div>
<p>This will print all your secrets</p>
<h3><a class="title-link" name="storing-passwords-in-a-keyring-managed-by-your-os" href="#storing-passwords-in-a-keyring-managed-by-your-os"></a> Storing passwords in a keyring managed by your OS</h3>
<p>Using <a href="http://pythonhosted.org/keyring/">Keyring</a> is an alternative way to <code class="highlighter-rouge">secrets.yaml</code>. They can be managed from the command line via the keyring script.</p>
@ -139,7 +161,7 @@
</code></pre>
</div>
<p>If you launch home Assistant now, you will be prompted for the keyring password to unlock your keyring.</p>
<p>If you launch Home Assistant now, you will be prompted for the keyring password to unlock your keyring.</p>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>hass
Config directory: /home/fab/.homeassistant

View file

@ -97,7 +97,7 @@
<p>As commenting code doesnt always happen, please read on for the details.</p>
<p>Now despite the logical assumption that the <code class="highlighter-rouge">configuration.yaml</code> will be replaced by this process it will in fact remain all be it in a much less cluttered form.</p>
<p>Now despite the logical assumption that the <code class="highlighter-rouge">configuration.yaml</code> will be replaced by this process it will in fact remain, albeit in a much less cluttered form.</p>
<p>In this lighter version we will still need what could be called the core snippet:</p>
@ -261,17 +261,26 @@ customize.yaml
<p>If you have issues checkout <code class="highlighter-rouge">home-assistant.log</code> in the configuration directory as well as your indentations. If all else fails, head over to the <a href="https://gitter.im/balloob/home-assistant">Gitter Chatroom</a> and ask away.</p>
<h3><a class="title-link" name="debugging-multiple-configuration-files" href="#debugging-multiple-configuration-files"></a> Debugging multiple configuration files</h3>
<p>If you have many configuration files, the <code class="highlighter-rouge">check_config</code> script allows you to see how Home Assistant interprets them:</p>
<ul>
<li>Listing all loaded files: <code class="highlighter-rouge">hass --script --check_config --files</code></li>
<li>Viewing a components config: <code class="highlighter-rouge">hass --script --check_config --info light</code></li>
<li>Or all components config: <code class="highlighter-rouge">hass --script check_config --info all</code></li>
</ul>
<p>You can get help from the command line using: <code class="highlighter-rouge">hass --script check_config --help</code></p>
<h3><a class="title-link" name="advanced-usage" href="#advanced-usage"></a> Advanced Usage</h3>
<p>We offer four advanced options to include whole directories at once.</p>
<p><code class="highlighter-rouge">!include_dir_list</code> will return content of a directory as a list with each file content being an entry in the list.</p>
<p><code class="highlighter-rouge">!include_dir_named</code> will return content of a directory as a dictionary which maps filename =&gt; content of file.</p>
<p><code class="highlighter-rouge">!include_dir_merge_list</code> will return content of a directory as a list by merging all files (which should contain a list) into 1 big list.</p>
<p><code class="highlighter-rouge">!include_dir_merge_named</code> will return content of a directory as a dictionary by loading each file and merging it into 1 big dictionary.</p>
<ul>
<li><code class="highlighter-rouge">!include_dir_list</code> will return the content of a directory as a list with each file content being an entry in the list.</li>
<li><code class="highlighter-rouge">!include_dir_named</code> will return the content of a directory as a dictionary which maps filename =&gt; content of file.</li>
<li><code class="highlighter-rouge">!include_dir_merge_list</code> will return the content of a directory as a list by merging all files (which should contain a list) into 1 big list.</li>
<li><code class="highlighter-rouge">!include_dir_merge_named</code> will return the content of a directory as a dictionary by loading each file and merging it into 1 big dictionary.</li>
</ul>
<h4><a class="title-link" name="example-include_dir_list" href="#example-include_dir_list"></a> Example: <code class="highlighter-rouge">!include_dir_list</code></h4>