-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(relayer): Support defining inventory config externally (#1316)
This allows the inventory config to be defined in a separate JSON file, where it's much easier to update and mainintain. To use this, define RELAYER_EXTERNAL_INVENTORY_CONFIG=<path-to-file>.
- Loading branch information
Showing
4 changed files
with
47 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import * as fs from "fs/promises"; | ||
import { typeguards } from "@across-protocol/sdk-v2"; | ||
|
||
export async function readFile(fileName: string): Promise<string> { | ||
try { | ||
return await fs.readFile(fileName, { encoding: "utf8" }); | ||
} catch (err) { | ||
// @dev fs methods can return errors that are not Error objects (i.e. errno). | ||
const msg = typeguards.isError(err) ? err.message : (err as Record<string, unknown>)?.code; | ||
throw new Error(`Unable to read ${fileName} (${msg ?? "unknown error"})`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters