Skip to content

Commit

Permalink
feat(env): fetch network from environment
Browse files Browse the repository at this point in the history
  • Loading branch information
imsk17 committed Aug 16, 2024
1 parent 6871c40 commit f6b959f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const Env = z.object({
TON_API_KEY: z.string().optional(),
SERVER_PORT: z.string().optional(),
SERVER_LINK: z.string().optional(),
NETWORK: z.union([z.literal("testnet"), z.literal("mainnet"), z.undefined()]),
});
export type Env = z.infer<typeof Env>;

Expand Down
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ async function main() {

let config: IBridgeConfig = prodBridgeConfig;

if (process.argv.includes("--testnet")) {
const network = process.env.NETWORK;
if (network === "testnet") {
logger.info("Starting up testnet");
config = testnetBridgeConfig;
logger.info("Setting up for testnet environment");
}

const deps = await configDeps(config, secrets, logger);
Expand Down

0 comments on commit f6b959f

Please sign in to comment.