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
9 changes: 4 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@
</div>

<main class="focused-main">
<div class="card" x-data="{ cfg: __APP_CONFIG__ }">
<!-- Hero: big headline (8 cols) + small text beside it (4 cols) -->
<div class="card" x-data="{ app: '__RUNWAY_APP__' }">
<div class="hero">
<div class="hero-head">
<p class="kicker">Get started — Bulletin № 01</p>
<p class="kicker">Get started</p>
<h1 class="hero-title">
<span x-text="cfg.app + ' is live'"></span
<span x-text="app + ' is live'"></span
><span class="exclaim">!</span>
</h1>
</div>
Expand All @@ -53,7 +52,7 @@ <h1 class="hero-title">
Connect your local directory to Runway, run:
<code
class="command"
x-text="'runway gitremote -a ' + cfg.app"
x-text="'runway gitremote -a ' + app"
></code>
</li>
<li>Deploy with <code class="command">runway app deploy</code></li>
Expand Down
7 changes: 4 additions & 3 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ function serveStatic(urlPath, res) {
});
}

// Inject server-side values as JSON so quotes and special chars stay safe.
// Inject the app name into the template. It sits inside a single-quoted
// Alpine string, so the only thing that could break it is a quote in the
// value — app names don't have those.
function render() {
const config = JSON.stringify({ app: RUNWAY_APP });
return template.replace("__APP_CONFIG__", config);
return template.replace("__RUNWAY_APP__", RUNWAY_APP);
}

const server = http.createServer((req, res) => {
Expand Down
3 changes: 2 additions & 1 deletion server.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ test("renders the env var into the page", async () => {
const res = await get(base + "/");
assert.strictEqual(res.status, 200);
assert.match(res.body, /hello-test/);
assert.doesNotMatch(res.body, /__APP_CONFIG__/);
assert.doesNotMatch(res.body, /__RUNWAY_APP__/);
assert.match(res.body, /x-data="\{ app: 'hello-test' \}"/);

const missing = await get(base + "/nope");
assert.strictEqual(missing.status, 404);
Expand Down