Skip to content

Commit 490f16f

Browse files
committed
cleanup
1 parent 491cd73 commit 490f16f

File tree

4 files changed

+0
-37
lines changed

4 files changed

+0
-37
lines changed

app/routes/healthcheck.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// learn more: https://fly.io/docs/reference/configuration/#services-http_checks
21
import type { LoaderFunction } from "@remix-run/node";
32

43
import { prisma } from "~/db.server";

app/routes/index.tsx

-5
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,6 @@ export default function Index() {
6666
<div className="mx-auto max-w-7xl py-2 px-4 sm:px-6 lg:px-8">
6767
<div className="mt-6 flex flex-wrap justify-center gap-8">
6868
{[
69-
{
70-
src: "https://user-images.githubusercontent.com/1500684/157764397-ccd8ea10-b8aa-4772-a99b-35de937319e1.svg",
71-
alt: "Fly.io",
72-
href: "https://fly.io",
73-
},
7469
{
7570
src: "https://user-images.githubusercontent.com/1500684/158238105-e7279a0c-1640-40db-86b0-3d3a10aab824.svg",
7671
alt: "PostgreSQL",

remix.init/index.js

-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ function getRandomString(length) {
1616

1717
async function main({ rootDirectory }) {
1818
const README_PATH = path.join(rootDirectory, "README.md");
19-
const FLY_TOML_PATH = path.join(rootDirectory, "fly.toml");
2019
const EXAMPLE_ENV_PATH = path.join(rootDirectory, ".env.example");
2120
const ENV_PATH = path.join(rootDirectory, ".env");
2221
const PACKAGE_JSON_PATH = path.join(rootDirectory, "package.json");
@@ -31,7 +30,6 @@ async function main({ rootDirectory }) {
3130
.replace(/[^a-zA-Z0-9-_]/g, "-");
3231

3332
const [prodContent, readme, env, packageJson] = await Promise.all([
34-
fs.readFile(FLY_TOML_PATH, "utf-8"),
3533
fs.readFile(README_PATH, "utf-8"),
3634
fs.readFile(EXAMPLE_ENV_PATH, "utf-8"),
3735
fs.readFile(PACKAGE_JSON_PATH, "utf-8"),
@@ -62,7 +60,6 @@ async function main({ rootDirectory }) {
6260
) + "\n";
6361

6462
await Promise.all([
65-
fs.writeFile(FLY_TOML_PATH, toml.stringify(prodToml)),
6663
fs.writeFile(README_PATH, newReadme),
6764
fs.writeFile(ENV_PATH, newEnv),
6865
fs.writeFile(PACKAGE_JSON_PATH, newPackageJson),

server.ts

-28
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ const app = express();
88

99
app.use((req, res, next) => {
1010
// helpful headers:
11-
res.set("x-fly-region", process.env.FLY_REGION ?? "unknown");
1211
res.set("Strict-Transport-Security", `max-age=${60 * 60 * 24 * 365 * 100}`);
1312

1413
// /clean-urls/ -> /clean-urls
@@ -21,33 +20,6 @@ app.use((req, res, next) => {
2120
next();
2221
});
2322

24-
// if we're not in the primary region, then we need to make sure all
25-
// non-GET/HEAD/OPTIONS requests hit the primary region rather than read-only
26-
// Postgres DBs.
27-
// learn more: https://fly.io/docs/getting-started/multi-region-databases/#replay-the-request
28-
app.all("*", function getReplayResponse(req, res, next) {
29-
const { method, path: pathname } = req;
30-
const { PRIMARY_REGION, FLY_REGION } = process.env;
31-
32-
const isMethodReplayable = !["GET", "OPTIONS", "HEAD"].includes(method);
33-
const isReadOnlyRegion =
34-
FLY_REGION && PRIMARY_REGION && FLY_REGION !== PRIMARY_REGION;
35-
36-
const shouldReplay = isMethodReplayable && isReadOnlyRegion;
37-
38-
if (!shouldReplay) return next();
39-
40-
const logInfo = {
41-
pathname,
42-
method,
43-
PRIMARY_REGION,
44-
FLY_REGION,
45-
};
46-
console.info(`Replaying:`, logInfo);
47-
res.set("fly-replay", `region=${PRIMARY_REGION}`);
48-
return res.sendStatus(409);
49-
});
50-
5123
app.use(compression());
5224

5325
// http://expressjs.com/en/advanced/best-practice-security.html#at-a-minimum-disable-x-powered-by-header

0 commit comments

Comments
 (0)