Skip to content

Commit

Permalink
Allow env vars to be sourced from both env_files and kwargs
Browse files Browse the repository at this point in the history
  • Loading branch information
dormant-user committed Aug 17, 2024
1 parent 12c03fd commit efa1393
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 19 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ nctl start
<summary><strong>Sourcing environment variables from an env file</strong></summary>

> _By default, `nctl` will look for a `.env` file in the current working directory._<br>
> Refer [samples] directory for examples.
</details>

Expand Down
3 changes: 1 addition & 2 deletions docs/README.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ <h2>Kick off<a class="headerlink" href="#kick-off" title="Permalink to this head
<h2>Environment Variables<a class="headerlink" href="#environment-variables" title="Permalink to this heading"></a></h2>
<details>
<summary><strong>Sourcing environment variables from an env file</strong></summary><blockquote>
<div><p><em>By default, <code class="docutils literal notranslate"><span class="pre">nctl</span></code> will look for a <code class="docutils literal notranslate"><span class="pre">.env</span></code> file in the current working directory.</em><br>
Refer [samples] directory for examples.</p>
<div><p><em>By default, <code class="docutils literal notranslate"><span class="pre">nctl</span></code> will look for a <code class="docutils literal notranslate"><span class="pre">.env</span></code> file in the current working directory.</em><br></p>
</div></blockquote>
</details><ul class="simple">
<li><p><strong>PORT</strong> - Port number to expose using ngrok.</p></li>
Expand Down
1 change: 0 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ nctl start
<summary><strong>Sourcing environment variables from an env file</strong></summary>

> _By default, `nctl` will look for a `.env` file in the current working directory._<br>
> Refer [samples] directory for examples.
</details>

Expand Down
1 change: 0 additions & 1 deletion docs/_sources/README.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ nctl start
<summary><strong>Sourcing environment variables from an env file</strong></summary>

> _By default, `nctl` will look for a `.env` file in the current working directory._<br>
> Refer [samples] directory for examples.

</details>

Expand Down
8 changes: 5 additions & 3 deletions docs/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,13 @@ <h2 id="D">D</h2>
<h2 id="E">E</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#nctl.squire.env_loader">env_loader() (in module nctl.squire)</a>
</li>
<li><a href="index.html#nctl.models.EnvConfig">EnvConfig (class in nctl.models)</a>
</li>
<li><a href="index.html#nctl.models.EnvConfig.Config">EnvConfig.Config (class in nctl.models)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#nctl.models.EnvConfig.Config">EnvConfig.Config (class in nctl.models)</a>
<li><a href="index.html#nctl.squire.envfile_loader">envfile_loader() (in module nctl.squire)</a>
</li>
<li><a href="index.html#nctl.logger.LogConfig.Config.extra">extra (nctl.logger.LogConfig.Config attribute)</a>

Expand Down Expand Up @@ -183,6 +183,8 @@ <h2 id="H">H</h2>
<h2 id="L">L</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#nctl.squire.load_env">load_env() (in module nctl.squire)</a>
</li>
<li><a href="index.html#nctl.logger.LogConfig.log">log (nctl.logger.LogConfig attribute)</a>

<ul>
Expand Down
22 changes: 20 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,8 @@ <h1>Models<a class="headerlink" href="#models" title="Permalink to this heading"
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="nctl.squire.env_loader">
<span class="sig-prename descclassname"><span class="pre">nctl.squire.</span></span><span class="sig-name descname"><span class="pre">env_loader</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">filename</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">os.PathLike</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#nctl.models.EnvConfig" title="nctl.models.EnvConfig"><span class="pre">EnvConfig</span></a></span></span><a class="headerlink" href="#nctl.squire.env_loader" title="Permalink to this definition"></a></dt>
<dt class="sig sig-object py" id="nctl.squire.envfile_loader">
<span class="sig-prename descclassname"><span class="pre">nctl.squire.</span></span><span class="sig-name descname"><span class="pre">envfile_loader</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">filename</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">os.PathLike</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#nctl.models.EnvConfig" title="nctl.models.EnvConfig"><span class="pre">EnvConfig</span></a></span></span><a class="headerlink" href="#nctl.squire.envfile_loader" title="Permalink to this definition"></a></dt>
<dd><p>Loads environment variables based on filetypes.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
Expand All @@ -447,6 +447,24 @@ <h1>Models<a class="headerlink" href="#models" title="Permalink to this heading"
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="nctl.squire.load_env">
<span class="sig-prename descclassname"><span class="pre">nctl.squire.</span></span><span class="sig-name descname"><span class="pre">load_env</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#nctl.models.EnvConfig" title="nctl.models.EnvConfig"><span class="pre">EnvConfig</span></a></span></span><a class="headerlink" href="#nctl.squire.load_env" title="Permalink to this definition"></a></dt>
<dd><p>Merge env vars from env_file with kwargs, giving priority to kwargs.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p>This function allows env vars to be loaded partially from .env files and partially through kwargs.</p>
</div>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>Returns a reference to the <code class="docutils literal notranslate"><span class="pre">EnvConfig</span></code> object.</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference internal" href="#nctl.models.EnvConfig" title="nctl.models.EnvConfig">EnvConfig</a></p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="nctl.squire.run_validations">
<span class="sig-prename descclassname"><span class="pre">nctl.squire.</span></span><span class="sig-name descname"><span class="pre">run_validations</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="headerlink" href="#nctl.squire.run_validations" title="Permalink to this definition"></a></dt>
Expand Down
Binary file modified docs/objects.inv
Binary file not shown.
Loading

0 comments on commit efa1393

Please sign in to comment.