install.sh reads INKWELL_SERVER, INKWELL_CHANNEL and INKWELL_TOKEN (#5372)
The installer's environment variables kept the ThoughtSync-era TS_ prefix after the rename to Inkwell. They are now INKWELL_*, as is the INKWELL_SERVER_DEFAULT line the server fills in when it serves the script. The old names are not read any more; the operator approved the clean cut. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,7 @@ from inkwell.installer import PLACEHOLDER, SOURCE_SCRIPT, render, server_address
|
||||
# DB-free, like test_client_dist: the route reads `public_url` from the live cache
|
||||
# rather than from the database, which is what makes it testable here.
|
||||
|
||||
SCRIPT = f"#!/bin/sh\nset -eu\n{PLACEHOLDER}\nserver=\"${{TS_SERVER:-$TS_SERVER_DEFAULT}}\"\n"
|
||||
SCRIPT = f"#!/bin/sh\nset -eu\n{PLACEHOLDER}\nserver=\"${{INKWELL_SERVER:-$INKWELL_SERVER_DEFAULT}}\"\n"
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
@@ -31,10 +31,10 @@ def test_the_published_script_carries_the_line_the_server_rewrites_exactly_once(
|
||||
|
||||
def test_render_writes_the_address_into_the_one_variable():
|
||||
body = render(SCRIPT, "https://notes.example.com")
|
||||
assert "TS_SERVER_DEFAULT='https://notes.example.com'" in body
|
||||
assert "INKWELL_SERVER_DEFAULT='https://notes.example.com'" in body
|
||||
assert PLACEHOLDER not in body
|
||||
# Nothing else moved.
|
||||
assert body.replace("TS_SERVER_DEFAULT='https://notes.example.com'", PLACEHOLDER) == SCRIPT
|
||||
assert body.replace("INKWELL_SERVER_DEFAULT='https://notes.example.com'", PLACEHOLDER) == SCRIPT
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
@@ -97,14 +97,14 @@ async def test_the_route_serves_the_script_pointed_at_this_server(app):
|
||||
assert resp.status_code == 200
|
||||
assert resp.mimetype == "text/plain"
|
||||
body = await resp.get_data(as_text=True)
|
||||
assert "TS_SERVER_DEFAULT='http://notes.example.com'" in body
|
||||
assert "INKWELL_SERVER_DEFAULT='http://notes.example.com'" in body
|
||||
assert body.startswith("#!/bin/sh")
|
||||
|
||||
|
||||
async def test_the_route_uses_the_public_address_when_one_is_set(app, monkeypatch):
|
||||
monkeypatch.setitem(settings._live, "public_url", "https://notes.example.com")
|
||||
resp = await app.test_client().get("/install.sh", headers={"Host": "inkwell:5000"})
|
||||
assert "TS_SERVER_DEFAULT='https://notes.example.com'" in await resp.get_data(as_text=True)
|
||||
assert "INKWELL_SERVER_DEFAULT='https://notes.example.com'" in await resp.get_data(as_text=True)
|
||||
|
||||
|
||||
async def test_the_route_refuses_rather_than_serve_an_unsafe_address(app, monkeypatch):
|
||||
@@ -113,7 +113,7 @@ async def test_the_route_refuses_rather_than_serve_an_unsafe_address(app, monkey
|
||||
monkeypatch.setitem(settings._live, "public_url", "https://notes.example.com/'$(id)'")
|
||||
resp = await app.test_client().get("/install.sh", headers={"Host": "notes.example.com"})
|
||||
assert resp.status_code == 500
|
||||
assert "TS_SERVER_DEFAULT" not in await resp.get_data(as_text=True)
|
||||
assert "INKWELL_SERVER_DEFAULT" not in await resp.get_data(as_text=True)
|
||||
|
||||
|
||||
async def test_a_server_with_no_copy_of_the_script_404s(app, monkeypatch, tmp_path):
|
||||
|
||||
Reference in New Issue
Block a user