Skip to content

Commit d3cb771

Browse files
committed
Default ALLOWED_HOSTS to [] but preflight error if not set
1 parent 793dd1b commit d3cb771

File tree

23 files changed

+147
-251
lines changed

23 files changed

+147
-251
lines changed

demos/full/app/settings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
SECRET_KEY = "test"
2-
ALLOWED_HOSTS = []
32
DEBUG = True
43
URLS_ROUTER = "app.urls.AppRouter"
54

plain-admin/tests/app/settings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
SECRET_KEY = "test"
2-
ALLOWED_HOSTS = []
32
URLS_ROUTER = "app.urls.AppRouter"
43
INSTALLED_PACKAGES = [
54
"plain.auth",

plain-api/tests/app/settings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
SECRET_KEY = "test"
2-
ALLOWED_HOSTS = []
32
URLS_ROUTER = "app.urls.AppRouter"
43
INSTALLED_PACKAGES = []

plain-auth/tests/app/settings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
SECRET_KEY = "test"
2-
ALLOWED_HOSTS = []
32
URLS_ROUTER = "app.urls.AppRouter"
43
INSTALLED_PACKAGES = [
54
"plain.auth",

plain-dev/plain/dev/core.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import json
21
import os
32
import platform
43
import socket
@@ -136,7 +135,6 @@ def run(self):
136135

137136
self.symlink_plain_src()
138137
self.modify_hosts_file()
139-
self.set_allowed_hosts()
140138

141139
click.secho("→ Running preflight checks... ", dim=True, nl=False)
142140
self.run_preflight()
@@ -261,19 +259,6 @@ def modify_hosts_file(self):
261259
)
262260
sys.exit(1)
263261

264-
def set_allowed_hosts(self):
265-
if "PLAIN_ALLOWED_HOSTS" not in os.environ:
266-
hostnames = [self.hostname]
267-
if self.tunnel_url:
268-
# Add the tunnel URL to the allowed hosts
269-
hostnames.append(self.tunnel_url.split("://")[1])
270-
allowed_hosts = json.dumps(hostnames)
271-
self.plain_env["PLAIN_ALLOWED_HOSTS"] = allowed_hosts
272-
self.custom_process_env["PLAIN_ALLOWED_HOSTS"] = allowed_hosts
273-
click.secho(
274-
f"Automatically set PLAIN_ALLOWED_HOSTS={allowed_hosts}", dim=True
275-
)
276-
277262
def run_preflight(self):
278263
if subprocess.run(["plain", "preflight"], env=self.plain_env).returncode:
279264
click.secho("Preflight check failed!", fg="red")

plain-dev/tests/settings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
ALLOWED_HOSTS = []
21
INSTALLED_PACKAGES = [
32
"plain.work",
43
]
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
SECRET_KEY = "test"
2-
ALLOWED_HOSTS = []
32
URLS_ROUTER = "app.urls.AppRouter"
43
INSTALLED_PACKAGES = ["plain.elements"]

plain-flags/tests/app/settings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
SECRET_KEY = "test"
2-
ALLOWED_HOSTS = []
32
URLS_ROUTER = "app.urls.AppRouter"
43
INSTALLED_PACKAGES = [
54
"plain.models",

plain-htmx/tests/app/settings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
SECRET_KEY = "test"
2-
ALLOWED_HOSTS = []
32
URLS_ROUTER = "app.urls.AppRouter"
43
INSTALLED_PACKAGES = [
54
"plain.htmx",

plain-models/tests/app/settings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
SECRET_KEY = "test"
2-
ALLOWED_HOSTS = []
32
URLS_ROUTER = "app.urls.AppRouter"
43
INSTALLED_PACKAGES = [
54
"plain.models",

0 commit comments

Comments
 (0)