Skip to content

Commit

Permalink
Simplify authentication to simple key value pairs
Browse files Browse the repository at this point in the history
Prevent duplicates when env files are used
Update validations, README.md and runbook
  • Loading branch information
dormant-user committed Jan 28, 2024
1 parent 3aa0d62 commit eb0f3f4
Show file tree
Hide file tree
Showing 11 changed files with 83 additions and 38 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import pystream

if __name__ == '__main__':
kwargs = dict(
authorization=[{"Alan Turing": "Pr0gRamM1ng"}, {"Linus Torvalds": "LinuxOS"}],
authorization={"Alan Turing": "Pr0gRamM1ng", "Linus Torvalds": "LinuxOS"},
video_source=os.path.join(os.path.expanduser('~'), 'Downloads')
)
# Add the following to host on local IP address, skip for localhost (127.0.0.1)
Expand All @@ -37,7 +37,7 @@ if __name__ == '__main__':
> To use custom filenames, set the env var `env_file` as `key` and the _filename_ as its `value`
**Mandatory**
- **AUTHORIZATION**: List of dictionaries with `username` as key and `password` as value.
- **AUTHORIZATION**: Dictionary of key-value pairs with `username` as key and `password` as value.
- **VIDEO_SOURCE**: Source path for video files.
> :bulb:   Files starting with `_` _(underscore)_ and `.` _(dot)_ will be ignored
Expand Down
4 changes: 2 additions & 2 deletions docs/README.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ <h2>Sample Usage<a class="headerlink" href="#sample-usage" title="Permalink to t

<span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s1">&#39;__main__&#39;</span><span class="p">:</span>
<span class="n">kwargs</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span>
<span class="n">authorization</span><span class="o">=</span><span class="p">[{</span><span class="s2">&quot;Alan Turing&quot;</span><span class="p">:</span> <span class="s2">&quot;Pr0gRamM1ng&quot;</span><span class="p">},</span> <span class="p">{</span><span class="s2">&quot;Linus Torvalds&quot;</span><span class="p">:</span> <span class="s2">&quot;LinuxOS&quot;</span><span class="p">}],</span>
<span class="n">authorization</span><span class="o">=</span><span class="p">{</span><span class="s2">&quot;Alan Turing&quot;</span><span class="p">:</span> <span class="s2">&quot;Pr0gRamM1ng&quot;</span><span class="p">,</span> <span class="s2">&quot;Linus Torvalds&quot;</span><span class="p">:</span> <span class="s2">&quot;LinuxOS&quot;</span><span class="p">},</span>
<span class="n">video_source</span><span class="o">=</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">expanduser</span><span class="p">(</span><span class="s1">&#39;~&#39;</span><span class="p">),</span> <span class="s1">&#39;Downloads&#39;</span><span class="p">)</span>
<span class="p">)</span>
<span class="c1"># Add the following to host on local IP address, skip for localhost (127.0.0.1)</span>
Expand All @@ -86,7 +86,7 @@ <h3>Env Variables<a class="headerlink" href="#env-variables" title="Permalink to
</div></blockquote>
<p><strong>Mandatory</strong></p>
<ul class="simple">
<li><p><strong>AUTHORIZATION</strong>: List of dictionaries with <code class="docutils literal notranslate"><span class="pre">username</span></code> as key and <code class="docutils literal notranslate"><span class="pre">password</span></code> as value.</p></li>
<li><p><strong>AUTHORIZATION</strong>: Dictionary of key-value pairs with <code class="docutils literal notranslate"><span class="pre">username</span></code> as key and <code class="docutils literal notranslate"><span class="pre">password</span></code> as value.</p></li>
<li><p><strong>VIDEO_SOURCE</strong>: Source path for video files.</p></li>
</ul>
<blockquote>
Expand Down
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import pystream

if __name__ == '__main__':
kwargs = dict(
authorization=[{"Alan Turing": "Pr0gRamM1ng"}, {"Linus Torvalds": "LinuxOS"}],
authorization={"Alan Turing": "Pr0gRamM1ng", "Linus Torvalds": "LinuxOS"},
video_source=os.path.join(os.path.expanduser('~'), 'Downloads')
)
# Add the following to host on local IP address, skip for localhost (127.0.0.1)
Expand All @@ -37,7 +37,7 @@ if __name__ == '__main__':
> To use custom filenames, set the env var `env_file` as `key` and the _filename_ as its `value`
**Mandatory**
- **AUTHORIZATION**: List of dictionaries with `username` as key and `password` as value.
- **AUTHORIZATION**: Dictionary of key-value pairs with `username` as key and `password` as value.
- **VIDEO_SOURCE**: Source path for video files.
> :bulb: &nbsp; Files starting with `_` _(underscore)_ and `.` _(dot)_ will be ignored
Expand Down
4 changes: 2 additions & 2 deletions docs/_sources/README.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import pystream

if __name__ == '__main__':
kwargs = dict(
authorization=[{"Alan Turing": "Pr0gRamM1ng"}, {"Linus Torvalds": "LinuxOS"}],
authorization={"Alan Turing": "Pr0gRamM1ng", "Linus Torvalds": "LinuxOS"},
video_source=os.path.join(os.path.expanduser('~'), 'Downloads')
)
# Add the following to host on local IP address, skip for localhost (127.0.0.1)
Expand All @@ -37,7 +37,7 @@ if __name__ == '__main__':
> To use custom filenames, set the env var `env_file` as `key` and the _filename_ as its `value`

**Mandatory**
- **AUTHORIZATION**: List of dictionaries with `username` as key and `password` as value.
- **AUTHORIZATION**: Dictionary of key-value pairs with `username` as key and `password` as value.
- **VIDEO_SOURCE**: Source path for video files.
> :bulb: &nbsp; Files starting with `_` _(underscore)_ and `.` _(dot)_ will be ignored

Expand Down
12 changes: 6 additions & 6 deletions docs/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ <h2 id="A">A</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pystream.models.config.Static.Config.arbitrary_types_allowed">arbitrary_types_allowed (pystream.models.config.Static.Config attribute)</a>
</li>
<li><a href="index.html#pystream.models.config.as_dict">as_dict() (in module pystream.models.config)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
Expand Down Expand Up @@ -296,6 +298,8 @@ <h2 id="N">N</h2>
<h2 id="P">P</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pystream.models.config.EnvConfig.parse_authorization">parse_authorization() (pystream.models.config.EnvConfig class method)</a>
</li>
<li><a href="index.html#pystream.models.config.EnvConfig.parse_video_host">parse_video_host() (pystream.models.config.EnvConfig class method)</a>
</li>
<li><a href="index.html#pystream.models.config.EnvConfig.parse_website">parse_website() (pystream.models.config.EnvConfig class method)</a>
Expand Down Expand Up @@ -339,15 +343,15 @@ <h2 id="P">P</h2>
<li><a href="index.html#module-pystream.models.images">module</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li>
pystream.models.secure

<ul>
<li><a href="index.html#module-pystream.models.secure">module</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li>
pystream.models.squire

Expand Down Expand Up @@ -482,10 +486,6 @@ <h2 id="U">U</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pystream.models.config.WebToken.username">username (pystream.models.config.WebToken attribute)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="index.html#pystream.models.config.EnvConfig.users_allowed">users_allowed (pystream.models.config.EnvConfig attribute)</a>
</li>
</ul></td>
</tr></table>
Expand Down
32 changes: 25 additions & 7 deletions docs/index.html

Large diffs are not rendered by default.

Binary file modified docs/objects.inv
Binary file not shown.
Loading

0 comments on commit eb0f3f4

Please sign in to comment.