Skip to content

Commit

Permalink
feat(arns): disable ArNS and sandboxing if ARNS_ROOT_HOST is unset
Browse files Browse the repository at this point in the history
Disables the ArNS and sandbox middlewares if ARNS_ROOT_HOST is not set.
This reduces potential routing annoyances when testing without Envoy
(not a recommended production setup).
  • Loading branch information
djwhitt committed Aug 29, 2023
1 parent f6105d8 commit 438f7f7
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,21 @@ const dataHandler = createDataHandler({
manifestPathResolver: system.manifestPathResolver,
});

app.use(
createArnsMiddleware({
dataHandler,
nameResolver: system.nameResolver,
}),
);

app.use(
createSandboxMiddleware({
rootHost: config.ARNS_ROOT_HOST,
sandboxProtocol: config.SANDBOX_PROTOCOL,
}),
);
if (config.ARNS_ROOT_HOST !== undefined) {
app.use(
createArnsMiddleware({
dataHandler,
nameResolver: system.nameResolver,
}),
);

app.use(
createSandboxMiddleware({
rootHost: config.ARNS_ROOT_HOST,
sandboxProtocol: config.SANDBOX_PROTOCOL,
}),
);
}

// OpenAPI Spec
const openapiDocument = YAML.parse(
Expand Down

0 comments on commit 438f7f7

Please sign in to comment.