plain.dev 0.29.1__py3-none-any.whl → 0.29.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
plain/dev/cli.py CHANGED
@@ -145,14 +145,13 @@ class Dev:
145
145
  self.plain_env = {
146
146
  "PYTHONUNBUFFERED": "true",
147
147
  "PLAIN_DEV": "true",
148
+ **os.environ,
148
149
  }
149
150
 
150
151
  if log_level:
151
152
  self.plain_env["PLAIN_LOG_LEVEL"] = log_level.upper()
152
153
  self.plain_env["APP_LOG_LEVEL"] = log_level.upper()
153
154
 
154
- self.plain_env.update(os.environ)
155
-
156
155
  self.custom_process_env = {
157
156
  **self.plain_env,
158
157
  "PORT": str(self.port),
@@ -202,7 +201,7 @@ class Dev:
202
201
 
203
202
  self.symlink_plain_src()
204
203
  self.modify_hosts_file()
205
- self.set_csrf_and_allowed_hosts()
204
+ self.set_allowed_hosts()
206
205
  self.run_preflight()
207
206
 
208
207
  # If we start services ourselves, we should manage the pidfile
@@ -355,22 +354,13 @@ class Dev:
355
354
  )
356
355
  sys.exit(1)
357
356
 
358
- def set_csrf_and_allowed_hosts(self):
359
- if "PLAIN_CSRF_TRUSTED_ORIGINS" not in os.environ:
360
- csrf_trusted_origins = json.dumps(
361
- [
362
- self.url,
363
- ]
364
- )
365
- self.plain_env["PLAIN_CSRF_TRUSTED_ORIGINS"] = csrf_trusted_origins
366
- self.custom_process_env["PLAIN_CSRF_TRUSTED_ORIGINS"] = csrf_trusted_origins
367
- click.secho(
368
- f"Automatically set PLAIN_CSRF_TRUSTED_ORIGINS={csrf_trusted_origins}",
369
- dim=True,
370
- )
371
-
357
+ def set_allowed_hosts(self):
372
358
  if "PLAIN_ALLOWED_HOSTS" not in os.environ:
373
- allowed_hosts = json.dumps([self.hostname])
359
+ hostnames = [self.hostname]
360
+ if self.tunnel_url:
361
+ # Add the tunnel URL to the allowed hosts
362
+ hostnames.append(self.tunnel_url.split("://")[1])
363
+ allowed_hosts = json.dumps(hostnames)
374
364
  self.plain_env["PLAIN_ALLOWED_HOSTS"] = allowed_hosts
375
365
  self.custom_process_env["PLAIN_ALLOWED_HOSTS"] = allowed_hosts
376
366
  click.secho(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plain.dev
3
- Version: 0.29.1
3
+ Version: 0.29.2
4
4
  Summary: Local development tools for Plain.
5
5
  Author-email: Dave Gaeddert <dave.gaeddert@dropseed.dev>
6
6
  License-Expression: BSD-3-Clause
@@ -1,6 +1,6 @@
1
1
  plain/dev/README.md,sha256=EQJ9lF-JQ9KQWJZ_j6CD3jbRquOLgDRlIPbgT7A2gG4,3658
2
2
  plain/dev/__init__.py,sha256=nRX1B0Br8gmqhJLqo5Z9PqzReDahBtbmwH6C-7hzuls,103
3
- plain/dev/cli.py,sha256=5rh-CSVmdcfBM6RrSD1SCUB0lYEb94NOmAd8LXicZr0,15678
3
+ plain/dev/cli.py,sha256=TqL2eDM5_0Sv_GcIpT5O0sbrvWIgiwMU6ZPyLZJ9qUs,15324
4
4
  plain/dev/debug.py,sha256=Ka84K8zUdF0kMYNyqiLYDrdzU1jU8LSOkts3hcw_Gok,1005
5
5
  plain/dev/default_settings.py,sha256=uXWYORWP_aRDwXIFXdu5kHyiBFUZzARIJdhPeFaX35c,75
6
6
  plain/dev/entrypoints.py,sha256=diqNwA6eydUMtoO7p_rH-DtSYsw5-GBmjFe1Z5bHagc,579
@@ -24,8 +24,8 @@ plain/dev/poncho/process.py,sha256=JJOKy-C6vMCg7-6JMCtu6C649h7HmOBSJqDP_hnX49I,2
24
24
  plain/dev/precommit/__init__.py,sha256=9ByBOIdM8DebChjNz-RH2atdz4vWe8somlwNEsbhwh4,40
25
25
  plain/dev/precommit/cli.py,sha256=KVHcG3Y_JZJNu3_MLIrO5s6yMYQfAArIU5L0hNWZUjg,3441
26
26
  plain/dev/templates/dev/requests.html,sha256=kQKJZq5L77juuL_t8UjcAehEU61U4RXNnKaAET-wAm8,7627
27
- plain_dev-0.29.1.dist-info/METADATA,sha256=xKFUKIWICvxJCwQwdok-X13y8-_lP2CORyE9HBjRFbo,4163
28
- plain_dev-0.29.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
29
- plain_dev-0.29.1.dist-info/entry_points.txt,sha256=zrcTOiFk_MLKsnYVlwVP7aMm1XLEqq7w4EBkJ-3ge-g,114
30
- plain_dev-0.29.1.dist-info/licenses/LICENSE,sha256=Cx4Dq9yR2fLHthf8Ke36B8QJvE1bZFXVzDIGE8wGzsY,4132
31
- plain_dev-0.29.1.dist-info/RECORD,,
27
+ plain_dev-0.29.2.dist-info/METADATA,sha256=jgWka03LvNVb8qv2UcBRzqZMmxGOf_gGrQ_eqgJ-JHY,4163
28
+ plain_dev-0.29.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
29
+ plain_dev-0.29.2.dist-info/entry_points.txt,sha256=zrcTOiFk_MLKsnYVlwVP7aMm1XLEqq7w4EBkJ-3ge-g,114
30
+ plain_dev-0.29.2.dist-info/licenses/LICENSE,sha256=Cx4Dq9yR2fLHthf8Ke36B8QJvE1bZFXVzDIGE8wGzsY,4132
31
+ plain_dev-0.29.2.dist-info/RECORD,,