Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion dbuild/templates/README.j2
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,9 @@ Save as `bastille-compose.yml`, then run `bastille up`.

{%- if ports and cit_mode in ("health", "screenshot") %}

Access at: `http://localhost:{{ ports[0].port if render_mode != "mkdocs" else port_var }}`
{#- Not localhost: a published port is a pf rdr, and pf never redirects the
host's own connections to it. #}
Open `http://<server>:{{ ports[0].port if render_mode != "mkdocs" else port_var }}` from another machine (the server's own browser can't use a published port).
{%- endif %}
{%- endif %}
{%- endblock %}
Expand Down
28 changes: 28 additions & 0 deletions tests/test_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1114,3 +1114,31 @@ def test_a_combination_without_env_has_no_env_step(self):
podman = outputs["README.md"].split("### Podman Compose", 1)[1].split("### AppJail", 1)[0]
self.assertNotIn("Save as `.env`", podman, "no .env to fill in")
self.assertIn("Save as `compose.yaml`:", podman)


class TestAccessLine(unittest.TestCase):
def test_access_is_from_another_machine_not_localhost(self):
with tempfile.TemporaryDirectory() as d:
repo = Path(d)
(repo / ".daemonless").mkdir()
(repo / ".daemonless" / "config.yaml").write_text("cit:\n mode: health\n")
(repo / "compose.yaml").write_text(
"x-daemonless:\n"
" title: \"Web\"\n"
" description: \"A web app.\"\n"
" category: \"Utilities\"\n"
" upstream_url: \"https://example.com\"\n"
"services:\n"
" web:\n"
" image: ghcr.io/daemonless/web:latest\n"
" ports:\n"
" - \"8080:8080\"\n"
)
(repo / "Containerfile.j2").write_text(CONTAINERFILE_J2)
with _chdir(repo):
cfg = dbuild_config.load(repo)
outputs, errors = docs.render_generated(cfg, argparse.Namespace(community=None), repo)
self.assertEqual(errors, [])
readme = outputs["README.md"]
self.assertIn("Open `http://<server>:8080` from another machine", readme)
self.assertNotIn("http://localhost:", readme)
Loading