/ docs / assets / features_01-host-specific.md.857720b4.js
features_01-host-specific.md.857720b4.js
1  import{_ as e,y as t,x as o,W as s}from"./plugin-vue_export-helper.f07d1dea.js";const p='{"title":"Host-specific Syncing","description":"","frontmatter":{},"headers":[{"level":2,"title":"Background","slug":"background"},{"level":2,"title":"Hostname Suffix","slug":"hostname-suffix"}],"relativePath":"features/01-host-specific.md","lastUpdated":1692639959838}',i={},a=s('<h1 id="host-specific-syncing-examples" tabindex="-1">Host-specific Syncing <sub>[<a href="/config/guide/04-host-specific.html"><strong>Examples</strong></a>]</sub> <a class="header-anchor" href="#host-specific-syncing-examples" aria-hidden="true">#</a></h1><h2 id="background" tabindex="-1">Background <a class="header-anchor" href="#background" aria-hidden="true">#</a></h2><blockquote><p>With more <em>servers</em> there must also come more <em>configuration files</em>.</p></blockquote><p>When you own more than one machine, you will eventually face the problem that one configuration file that works perfectly on one machine does not work well on another, be it due to their monitor sizes, network conditions, architectures, etc..</p><h2 id="hostname-suffix" tabindex="-1">Hostname Suffix <a class="header-anchor" href="#hostname-suffix" aria-hidden="true">#</a></h2><p>What you want is to populate different configuration files for different machines. To allow multiple items with the same name name, <code>dt-cli</code> checks for an additional <strong>hostname suffix</strong> for every source item, and ignores those items which are meant for other hosts. <code>dt-cli</code> works with them quite intuitively. In short, it ignores items for other machines, and syncs items for current machine whenever possible.</p><div class="info custom-block"><p class="custom-block-title">INFO</p><p>Specifically, with <strong>hostname suffix</strong> defined, source items can be (virtually) categorized into 3 types:</p><ul><li><code>Current</code>: Items that are host-specific, and are for current machine only;</li><li><code>General</code>: Items that are for all machines;</li><li><code>Other</code>: Items that are host-specific, but are for some other machine.</li></ul><p><code>dt-cli</code> will sync items that are of type <code>Current</code> if they exist; if no <code>Current</code> item exists, <code>dt-cli</code> finds <code>General</code> items and sync them. Items of type <code>Other</code> are ignored for current machine.</p></div><p>A <strong>hostname suffix</strong> comprises of a <strong>hostname separator</strong> and a <strong>hostname</strong>:</p><ul><li>Hostname separator: Defined in configuration file as <code>hostname_sep</code>, <a href="/config/key-references.html#hostname-sep">globally</a> or <a href="/config/key-references.html#hostname-sep-1">per-group</a>.</li><li>Hostname: Current machine&#39;s hostname.</li></ul><div class="warning custom-block"><p class="custom-block-title">Multiple Occurrences of <code>hostname_sep</code></p><p>To eliminate ambiguity, the hostname separator should appear at most once in any of the source items. Multiple occurrences of the hostname separator will cause <code>dt-cli</code> to panic.</p></div><p>The default value (when not configured) for <code>hostname_sep</code> is <code>@@</code>. If a directory is marked as host-specific, all of its children will only be synced when the directory is for current machine.</p>',11),n=[a];function c(r,l,h,d,f,m){return o(),t("div",null,n)}var g=e(i,[["render",c]]);export{p as __pageData,g as default};