Skip to content

Commit

Permalink
Deploying to gh-pages from @ ebcfb46 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
darthtrevino committed Oct 4, 2024
1 parent ffec34a commit a06928e
Show file tree
Hide file tree
Showing 15 changed files with 571 additions and 574 deletions.
24 changes: 12 additions & 12 deletions 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,11 @@


<li class="md-nav__item">
<a href="/essex-config/annotations/" class="md-nav__link">
<a href="/essex-config/" class="md-nav__link">


<span class="md-ellipsis">
Field Annotations
Getting Started
</span>


Expand All @@ -284,11 +284,11 @@


<li class="md-nav__item">
<a href="/essex-config/documentation/" class="md-nav__link">
<a href="/essex-config/sources/" class="md-nav__link">


<span class="md-ellipsis">
Documentation Generation
Sources
</span>


Expand All @@ -305,11 +305,11 @@


<li class="md-nav__item">
<a href="/essex-config/" class="md-nav__link">
<a href="/essex-config/annotations/" class="md-nav__link">


<span class="md-ellipsis">
Getting Started
Field Annotations
</span>


Expand All @@ -326,11 +326,11 @@


<li class="md-nav__item">
<a href="/essex-config/sources/" class="md-nav__link">
<a href="/essex-config/documentation/" class="md-nav__link">


<span class="md-ellipsis">
Sources
Documentation Generation
</span>


Expand Down Expand Up @@ -389,11 +389,11 @@


<li class="md-nav__item">
<a href="/reactivedataflow/examples/" class="md-nav__link">
<a href="/reactivedataflow/" class="md-nav__link">


<span class="md-ellipsis">
Examples
Getting Started
</span>


Expand All @@ -410,11 +410,11 @@


<li class="md-nav__item">
<a href="/reactivedataflow/" class="md-nav__link">
<a href="/reactivedataflow/examples/" class="md-nav__link">


<span class="md-ellipsis">
Getting Started
Examples
</span>


Expand Down
138 changes: 69 additions & 69 deletions essex-config/annotations/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@



<link rel="prev" href="../..">
<link rel="prev" href="../sources/">


<link rel="next" href="../documentation/">
Expand Down Expand Up @@ -271,6 +271,48 @@





<li class="md-nav__item">
<a href="../" class="md-nav__link">


<span class="md-ellipsis">
Getting Started
</span>


</a>
</li>










<li class="md-nav__item">
<a href="../sources/" class="md-nav__link">


<span class="md-ellipsis">
Sources
</span>


</a>
</li>











Expand Down Expand Up @@ -367,48 +409,6 @@









<li class="md-nav__item">
<a href="../" class="md-nav__link">


<span class="md-ellipsis">
Getting Started
</span>


</a>
</li>










<li class="md-nav__item">
<a href="../sources/" class="md-nav__link">


<span class="md-ellipsis">
Sources
</span>


</a>
</li>




</ul>
</nav>

Expand Down Expand Up @@ -458,11 +458,11 @@


<li class="md-nav__item">
<a href="../../reactivedataflow/examples/" class="md-nav__link">
<a href="../../reactivedataflow/" class="md-nav__link">


<span class="md-ellipsis">
Examples
Getting Started
</span>


Expand All @@ -479,11 +479,11 @@


<li class="md-nav__item">
<a href="../../reactivedataflow/" class="md-nav__link">
<a href="../../reactivedataflow/examples/" class="md-nav__link">


<span class="md-ellipsis">
Getting Started
Examples
</span>


Expand Down Expand Up @@ -587,16 +587,16 @@ <h1 id="field-annotations">Field Annotations</h1>
<p>Essex-config offers Annotations for fields which modifies the behavior of the basic configuration loading.</p>
<h2 id="prefixes">Prefixes</h2>
<p>The <code>load_config</code> function supports using a prefix for values in different sources:</p>
<div class="highlight"><pre><span></span><code><span class="k">class</span> <span class="nc">CustomerDatabase</span><span class="p">(</span><span class="n">BaseModel</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Configuration for connecting to the Customer Database&quot;&quot;&quot;</span>
<span class="n">host</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="n">Field</span><span class="p">(</span><span class="n">default</span><span class="o">=</span><span class="s2">&quot;127.0.0.1&quot;</span><span class="p">,</span> <span class="n">description</span><span class="o">=</span><span class="s2">&quot;DB connection host&quot;</span><span class="p">)</span>
<span class="n">port</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="n">Field</span><span class="p">(</span><span class="n">description</span><span class="o">=</span><span class="s2">&quot;DB connection port&quot;</span><span class="p">)</span>
<span class="n">password</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="n">Field</span><span class="p">(</span><span class="n">description</span><span class="o">=</span><span class="s2">&quot;DB connection password&quot;</span><span class="p">)</span>


<span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s2">&quot;__main__&quot;</span><span class="p">:</span>
<span class="n">config</span> <span class="o">=</span> <span class="n">load_config</span><span class="p">(</span><span class="n">CustomerDatabase</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">&quot;customer_db&quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">config</span><span class="p">)</span>
<div class="highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="k">class</span> <span class="nc">CustomerDatabase</span><span class="p">(</span><span class="n">BaseModel</span><span class="p">):</span>
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Configuration for connecting to the Customer Database&quot;&quot;&quot;</span>
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a> <span class="n">host</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="n">Field</span><span class="p">(</span><span class="n">default</span><span class="o">=</span><span class="s2">&quot;127.0.0.1&quot;</span><span class="p">,</span> <span class="n">description</span><span class="o">=</span><span class="s2">&quot;DB connection host&quot;</span><span class="p">)</span>
<a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a> <span class="n">port</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="n">Field</span><span class="p">(</span><span class="n">description</span><span class="o">=</span><span class="s2">&quot;DB connection port&quot;</span><span class="p">)</span>
<a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a> <span class="n">password</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="n">Field</span><span class="p">(</span><span class="n">description</span><span class="o">=</span><span class="s2">&quot;DB connection password&quot;</span><span class="p">)</span>
<a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a>
<a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a>
<a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a><span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s2">&quot;__main__&quot;</span><span class="p">:</span>
<a id="__codelineno-0-9" name="__codelineno-0-9" href="#__codelineno-0-9"></a> <span class="n">config</span> <span class="o">=</span> <span class="n">load_config</span><span class="p">(</span><span class="n">CustomerDatabase</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">&quot;customer_db&quot;</span><span class="p">)</span>
<a id="__codelineno-0-10" name="__codelineno-0-10" href="#__codelineno-0-10"></a> <span class="nb">print</span><span class="p">(</span><span class="n">config</span><span class="p">)</span>
</code></pre></div>
<p>With a prefix, sources look for values accordingly:</p>
<ul>
Expand All @@ -605,20 +605,20 @@ <h2 id="prefixes">Prefixes</h2>
<li><code>KeyvaultSource()</code>: Joins the prefix with the key using <code>.</code>.</li>
</ul>
<p>To add a prefix for a specific field, use <code>Annotated</code>:</p>
<div class="highlight"><pre><span></span><code><span class="k">class</span> <span class="nc">CustomerDatabase</span><span class="p">(</span><span class="n">BaseModel</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Configuration for connecting to the Customer Database&quot;&quot;&quot;</span>
<span class="n">host</span><span class="p">:</span> <span class="n">Annotated</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Prefixed</span><span class="p">(</span><span class="s2">&quot;some_prefix&quot;</span><span class="p">)]</span> <span class="o">=</span> <span class="n">Field</span><span class="p">(</span><span class="n">default</span><span class="o">=</span><span class="s2">&quot;127.0.0.1&quot;</span><span class="p">,</span> <span class="n">description</span><span class="o">=</span><span class="s2">&quot;DB connection host&quot;</span><span class="p">)</span>
<span class="n">port</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="n">Field</span><span class="p">(</span><span class="n">description</span><span class="o">=</span><span class="s2">&quot;DB connection port&quot;</span><span class="p">)</span>
<span class="n">password</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="n">Field</span><span class="p">(</span><span class="n">description</span><span class="o">=</span><span class="s2">&quot;DB connection password&quot;</span><span class="p">)</span>
<div class="highlight"><pre><span></span><code><a id="__codelineno-1-1" name="__codelineno-1-1" href="#__codelineno-1-1"></a><span class="k">class</span> <span class="nc">CustomerDatabase</span><span class="p">(</span><span class="n">BaseModel</span><span class="p">):</span>
<a id="__codelineno-1-2" name="__codelineno-1-2" href="#__codelineno-1-2"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Configuration for connecting to the Customer Database&quot;&quot;&quot;</span>
<a id="__codelineno-1-3" name="__codelineno-1-3" href="#__codelineno-1-3"></a> <span class="n">host</span><span class="p">:</span> <span class="n">Annotated</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Prefixed</span><span class="p">(</span><span class="s2">&quot;some_prefix&quot;</span><span class="p">)]</span> <span class="o">=</span> <span class="n">Field</span><span class="p">(</span><span class="n">default</span><span class="o">=</span><span class="s2">&quot;127.0.0.1&quot;</span><span class="p">,</span> <span class="n">description</span><span class="o">=</span><span class="s2">&quot;DB connection host&quot;</span><span class="p">)</span>
<a id="__codelineno-1-4" name="__codelineno-1-4" href="#__codelineno-1-4"></a> <span class="n">port</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="n">Field</span><span class="p">(</span><span class="n">description</span><span class="o">=</span><span class="s2">&quot;DB connection port&quot;</span><span class="p">)</span>
<a id="__codelineno-1-5" name="__codelineno-1-5" href="#__codelineno-1-5"></a> <span class="n">password</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="n">Field</span><span class="p">(</span><span class="n">description</span><span class="o">=</span><span class="s2">&quot;DB connection password&quot;</span><span class="p">)</span>
</code></pre></div>
<p>In this case, the prefix for <code>host</code> will be <code>customer_db.some_prefix</code>.</p>
<h2 id="alias">Alias</h2>
<p>Use <code>Annotated</code> to add source-specific aliases:</p>
<div class="highlight"><pre><span></span><code><span class="k">class</span> <span class="nc">CustomerDatabase</span><span class="p">(</span><span class="n">BaseModel</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Configuration for connecting to the Customer Database&quot;&quot;&quot;</span>
<span class="n">host</span><span class="p">:</span> <span class="n">Annotated</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Alias</span><span class="p">(</span><span class="n">EnvSource</span><span class="p">,</span> <span class="p">[</span><span class="s2">&quot;customer_db_host&quot;</span><span class="p">])]</span> <span class="o">=</span> <span class="n">Field</span><span class="p">(</span><span class="n">default</span><span class="o">=</span><span class="s2">&quot;127.0.0.1&quot;</span><span class="p">,</span> <span class="n">description</span><span class="o">=</span><span class="s2">&quot;DB connection host&quot;</span><span class="p">)</span>
<span class="n">port</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="n">Field</span><span class="p">(</span><span class="n">description</span><span class="o">=</span><span class="s2">&quot;DB connection port&quot;</span><span class="p">)</span>
<span class="n">password</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="n">Field</span><span class="p">(</span><span class="n">description</span><span class="o">=</span><span class="s2">&quot;DB connection password&quot;</span><span class="p">)</span>
<div class="highlight"><pre><span></span><code><a id="__codelineno-2-1" name="__codelineno-2-1" href="#__codelineno-2-1"></a><span class="k">class</span> <span class="nc">CustomerDatabase</span><span class="p">(</span><span class="n">BaseModel</span><span class="p">):</span>
<a id="__codelineno-2-2" name="__codelineno-2-2" href="#__codelineno-2-2"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Configuration for connecting to the Customer Database&quot;&quot;&quot;</span>
<a id="__codelineno-2-3" name="__codelineno-2-3" href="#__codelineno-2-3"></a> <span class="n">host</span><span class="p">:</span> <span class="n">Annotated</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Alias</span><span class="p">(</span><span class="n">EnvSource</span><span class="p">,</span> <span class="p">[</span><span class="s2">&quot;customer_db_host&quot;</span><span class="p">])]</span> <span class="o">=</span> <span class="n">Field</span><span class="p">(</span><span class="n">default</span><span class="o">=</span><span class="s2">&quot;127.0.0.1&quot;</span><span class="p">,</span> <span class="n">description</span><span class="o">=</span><span class="s2">&quot;DB connection host&quot;</span><span class="p">)</span>
<a id="__codelineno-2-4" name="__codelineno-2-4" href="#__codelineno-2-4"></a> <span class="n">port</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="n">Field</span><span class="p">(</span><span class="n">description</span><span class="o">=</span><span class="s2">&quot;DB connection port&quot;</span><span class="p">)</span>
<a id="__codelineno-2-5" name="__codelineno-2-5" href="#__codelineno-2-5"></a> <span class="n">password</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="n">Field</span><span class="p">(</span><span class="n">description</span><span class="o">=</span><span class="s2">&quot;DB connection password&quot;</span><span class="p">)</span>
</code></pre></div>
<p><code>essex-config</code> will look to populate <code>host</code> from <code>customer_db_host</code> when using the <code>EnvSource</code>.</p>

Expand Down Expand Up @@ -650,7 +650,7 @@ <h2 id="alias">Alias</h2>
<nav class="md-footer__inner md-grid" aria-label="Footer" >


<a href="../.." class="md-footer__link md-footer__link--prev" aria-label="Previous: Intro">
<a href="../sources/" class="md-footer__link md-footer__link--prev" aria-label="Previous: Sources">
<div class="md-footer__button md-icon">

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11z"/></svg>
Expand All @@ -660,7 +660,7 @@ <h2 id="alias">Alias</h2>
Previous
</span>
<div class="md-ellipsis">
Intro
Sources
</div>
</div>
</a>
Expand Down
Loading

0 comments on commit a06928e

Please sign in to comment.