Skip to content

Commit c0917e9

Browse files
committed
Load/scan any .env file during startup
Log daemon services launched in the background Change list to tuple wherever possible Unhook version number dependency on release notes
1 parent 68c7d58 commit c0917e9

16 files changed

+152
-105
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ venv
33
.idea
44

55
# Env vars stored in a .env file
6-
.env
6+
*.env
77

88
# File generated when an EC2 instance in spunup
99
*.json

README.md

+14-11
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Expose an app/api running on local host to public internet using AWS EC2
33

44
### Requirements
5-
- Access to an AWS account.
5+
- Access to an AWS account and [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html#getting-started-install-instructions) configured.
66
- A `service/app/api` running on a specific port that has to be exposed to public internet.
77
- **[Optional]** A domain `example.com` hosted on `route53`.
88

@@ -14,14 +14,17 @@ Environment variables can be loaded from a `.env` file.
1414
- `PORT`: Port number that has to be exposed (on which a localhost `service/app/api` is running)
1515

1616
**Optional Args:**
17-
- `AMI_ID`: ID of any public AMI with an Ubuntu OS. Defaults to a region specific image ID.
18-
- `ACCESS_KEY`: Access key to access AWS resources. Defaults to `~/.aws/config`
19-
- `SECRET_KEY`: Secret key to access AWS resources. Defaults to `~/.aws/config`
20-
- `REGION_NAME`: Region name where the instance should live. Defaults to `US-WEST-2`
21-
- `DOMAIN`: If the domain name is registered using `route53`. *Example: `mywebsite.com`*
22-
- `SUBDOMAIN`: Sub-domain that has to be added for the domain name. *Example: `tunnel.mywebsite.com`*
23-
- `EMAIL`: Email address to create the self-signed SSL and private key. Defaults to `[email protected]`
24-
- `ORG`: Organization name for the certificate. Defaults to the AWS endpoint.
17+
- `IMAGE_ID`: ID of any public AMI with an Ubuntu OS. Defaults to a region specific image ID.
18+
- `AWS_ACCESS_KEY`: Access key to access AWS resources. Defaults to `~/.aws/config`
19+
- `AWS_SECRET_KEY`: Secret key to access AWS resources. Defaults to `~/.aws/config`
20+
- `AWS_REGION_NAME`: Region name where the instance should live. Defaults to `US-WEST-2`
21+
22+
*Optionally `.env` files can also be scanned for:*
23+
```python
24+
import expose
25+
26+
expose.load_env(scan=True)
27+
```
2528

2629
<details>
2730
<summary><strong>Setup a custom endpoint</strong></summary>
@@ -58,8 +61,8 @@ To manually generate a self-signed cert:
5861

5962
Simply let `expose` create a self-signed SSL certificate and a private key.
6063

61-
- `EMAIL`: Email address to create the self-signed SSL and private key. Defaults to `[email protected]`
62-
- `ORG`: Organization name for the certificate. Defaults to the AWS endpoint.
64+
- `EMAIL_ADDRESS`: Email address to create the self-signed SSL and private key. Defaults to `[email protected]`
65+
- `ORGANIZATION`: Organization name for the certificate. Defaults to the AWS endpoint.
6366

6467
</details>
6568

docs/README.html

+13-11
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ <h1>Expose localhost using EC2<a class="headerlink" href="#expose-localhost-usin
4848
<section id="requirements">
4949
<h2>Requirements<a class="headerlink" href="#requirements" title="Permalink to this heading"></a></h2>
5050
<ul class="simple">
51-
<li><p>Access to an AWS account.</p></li>
51+
<li><p>Access to an AWS account and <a class="reference external" href="https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html#getting-started-install-instructions">AWS CLI</a> configured.</p></li>
5252
<li><p>A <code class="docutils literal notranslate"><span class="pre">service/app/api</span></code> running on a specific port that has to be exposed to public internet.</p></li>
5353
<li><p><strong>[Optional]</strong> A domain <code class="docutils literal notranslate"><span class="pre">example.com</span></code> hosted on <code class="docutils literal notranslate"><span class="pre">route53</span></code>.</p></li>
5454
</ul>
@@ -64,15 +64,17 @@ <h3>Environment Variables:<a class="headerlink" href="#environment-variables" ti
6464
</ul>
6565
<p><strong>Optional Args:</strong></p>
6666
<ul class="simple">
67-
<li><p><code class="docutils literal notranslate"><span class="pre">AMI_ID</span></code>: ID of any public AMI with an Ubuntu OS. Defaults to a region specific image ID.</p></li>
68-
<li><p><code class="docutils literal notranslate"><span class="pre">ACCESS_KEY</span></code>: Access key to access AWS resources. Defaults to <code class="docutils literal notranslate"><span class="pre">~/.aws/config</span></code></p></li>
69-
<li><p><code class="docutils literal notranslate"><span class="pre">SECRET_KEY</span></code>: Secret key to access AWS resources. Defaults to <code class="docutils literal notranslate"><span class="pre">~/.aws/config</span></code></p></li>
70-
<li><p><code class="docutils literal notranslate"><span class="pre">REGION_NAME</span></code>: Region name where the instance should live. Defaults to <code class="docutils literal notranslate"><span class="pre">US-WEST-2</span></code></p></li>
71-
<li><p><code class="docutils literal notranslate"><span class="pre">DOMAIN</span></code>: If the domain name is registered using <code class="docutils literal notranslate"><span class="pre">route53</span></code>. <em>Example: <code class="docutils literal notranslate"><span class="pre">mywebsite.com</span></code></em></p></li>
72-
<li><p><code class="docutils literal notranslate"><span class="pre">SUBDOMAIN</span></code>: Sub-domain that has to be added for the domain name. <em>Example: <code class="docutils literal notranslate"><span class="pre">tunnel.mywebsite.com</span></code></em></p></li>
73-
<li><p><code class="docutils literal notranslate"><span class="pre">EMAIL</span></code>: Email address to create the self-signed SSL and private key. Defaults to <code class="docutils literal notranslate"><span class="pre">USER&#64;expose-localhost.com</span></code></p></li>
74-
<li><p><code class="docutils literal notranslate"><span class="pre">ORG</span></code>: Organization name for the certificate. Defaults to the AWS endpoint.</p></li>
67+
<li><p><code class="docutils literal notranslate"><span class="pre">IMAGE_ID</span></code>: ID of any public AMI with an Ubuntu OS. Defaults to a region specific image ID.</p></li>
68+
<li><p><code class="docutils literal notranslate"><span class="pre">AWS_ACCESS_KEY</span></code>: Access key to access AWS resources. Defaults to <code class="docutils literal notranslate"><span class="pre">~/.aws/config</span></code></p></li>
69+
<li><p><code class="docutils literal notranslate"><span class="pre">AWS_SECRET_KEY</span></code>: Secret key to access AWS resources. Defaults to <code class="docutils literal notranslate"><span class="pre">~/.aws/config</span></code></p></li>
70+
<li><p><code class="docutils literal notranslate"><span class="pre">AWS_REGION_NAME</span></code>: Region name where the instance should live. Defaults to <code class="docutils literal notranslate"><span class="pre">US-WEST-2</span></code></p></li>
7571
</ul>
72+
<p><em>Optionally <code class="docutils literal notranslate"><span class="pre">.env</span></code> files can also be scanned for:</em></p>
73+
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">expose</span>
74+
75+
<span class="n">expose</span><span class="o">.</span><span class="n">load_env</span><span class="p">(</span><span class="n">scan</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
76+
</pre></div>
77+
</div>
7678
<details>
7779
<summary><strong>Setup a custom endpoint</strong></summary><p>The public DNS names for EC2 instances are long and messy. To avoid that, an <code class="docutils literal notranslate"><span class="pre">A</span></code> record can be added to the <code class="docutils literal notranslate"><span class="pre">route53</span></code> hosted zone.</p>
7880
<p>:warning:   Requires an active hosted zone on <code class="docutils literal notranslate"><span class="pre">route53</span></code>.</p>
@@ -100,8 +102,8 @@ <h3>Certificate:<a class="headerlink" href="#certificate" title="Permalink to th
100102
<p>[OR]</p>
101103
<p>Simply let <code class="docutils literal notranslate"><span class="pre">expose</span></code> create a self-signed SSL certificate and a private key.</p>
102104
<ul class="simple">
103-
<li><p><code class="docutils literal notranslate"><span class="pre">EMAIL</span></code>: Email address to create the self-signed SSL and private key. Defaults to <code class="docutils literal notranslate"><span class="pre">USER&#64;expose-localhost.com</span></code></p></li>
104-
<li><p><code class="docutils literal notranslate"><span class="pre">ORG</span></code>: Organization name for the certificate. Defaults to the AWS endpoint.</p></li>
105+
<li><p><code class="docutils literal notranslate"><span class="pre">EMAIL_ADDRESS</span></code>: Email address to create the self-signed SSL and private key. Defaults to <code class="docutils literal notranslate"><span class="pre">USER&#64;expose-localhost.com</span></code></p></li>
106+
<li><p><code class="docutils literal notranslate"><span class="pre">ORGANIZATION</span></code>: Organization name for the certificate. Defaults to the AWS endpoint.</p></li>
105107
</ul>
106108
</details></section>
107109
</section>

docs/_sources/README.md.txt

+14-11
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Expose an app/api running on local host to public internet using AWS EC2
33

44
### Requirements
5-
- Access to an AWS account.
5+
- Access to an AWS account and [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html#getting-started-install-instructions) configured.
66
- A `service/app/api` running on a specific port that has to be exposed to public internet.
77
- **[Optional]** A domain `example.com` hosted on `route53`.
88

@@ -14,14 +14,17 @@ Environment variables can be loaded from a `.env` file.
1414
- `PORT`: Port number that has to be exposed (on which a localhost `service/app/api` is running)
1515

1616
**Optional Args:**
17-
- `AMI_ID`: ID of any public AMI with an Ubuntu OS. Defaults to a region specific image ID.
18-
- `ACCESS_KEY`: Access key to access AWS resources. Defaults to `~/.aws/config`
19-
- `SECRET_KEY`: Secret key to access AWS resources. Defaults to `~/.aws/config`
20-
- `REGION_NAME`: Region name where the instance should live. Defaults to `US-WEST-2`
21-
- `DOMAIN`: If the domain name is registered using `route53`. *Example: `mywebsite.com`*
22-
- `SUBDOMAIN`: Sub-domain that has to be added for the domain name. *Example: `tunnel.mywebsite.com`*
23-
- `EMAIL`: Email address to create the self-signed SSL and private key. Defaults to `[email protected]`
24-
- `ORG`: Organization name for the certificate. Defaults to the AWS endpoint.
17+
- `IMAGE_ID`: ID of any public AMI with an Ubuntu OS. Defaults to a region specific image ID.
18+
- `AWS_ACCESS_KEY`: Access key to access AWS resources. Defaults to `~/.aws/config`
19+
- `AWS_SECRET_KEY`: Secret key to access AWS resources. Defaults to `~/.aws/config`
20+
- `AWS_REGION_NAME`: Region name where the instance should live. Defaults to `US-WEST-2`
21+
22+
*Optionally `.env` files can also be scanned for:*
23+
```python
24+
import expose
25+
26+
expose.load_env(scan=True)
27+
```
2528

2629
<details>
2730
<summary><strong>Setup a custom endpoint</strong></summary>
@@ -58,8 +61,8 @@ To manually generate a self-signed cert:
5861

5962
Simply let `expose` create a self-signed SSL certificate and a private key.
6063

61-
- `EMAIL`: Email address to create the self-signed SSL and private key. Defaults to `[email protected]`
62-
- `ORG`: Organization name for the certificate. Defaults to the AWS endpoint.
64+
- `EMAIL_ADDRESS`: Email address to create the self-signed SSL and private key. Defaults to `[email protected]`
65+
- `ORGANIZATION`: Organization name for the certificate. Defaults to the AWS endpoint.
6366

6467
</details>
6568

docs/genindex.html

+6-2
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,15 @@ <h2 id="S">S</h2>
238238
</li>
239239
<li><a href="index.html#expose.helpers.server.Server.server_write">server_write() (expose.helpers.server.Server method)</a>
240240
</li>
241-
</ul></td>
242-
<td style="width: 33%; vertical-align: top;"><ul>
243241
<li><a href="index.html#expose.main.Tunnel.start">start() (expose.main.Tunnel method)</a>
244242
</li>
243+
</ul></td>
244+
<td style="width: 33%; vertical-align: top;"><ul>
245245
<li><a href="index.html#expose.main.Tunnel.stop">stop() (expose.main.Tunnel method)</a>
246+
</li>
247+
<li><a href="index.html#expose.helpers.defaults.AWSDefaults.SUPPORTED_ACTIONS">SUPPORTED_ACTIONS (expose.helpers.defaults.AWSDefaults attribute)</a>
248+
</li>
249+
<li><a href="index.html#expose.helpers.defaults.AWSDefaults.SUPPORTED_RECORDS">SUPPORTED_RECORDS (expose.helpers.defaults.AWSDefaults attribute)</a>
246250
</li>
247251
</ul></td>
248252
</tr></table>

0 commit comments

Comments
 (0)