Skip to content

Commit

Permalink
fix(cli): ignore .env file for cartesi run
Browse files Browse the repository at this point in the history
  • Loading branch information
endersonmaia committed Aug 5, 2024
1 parent 14f4c6a commit 64af221
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/short-hairs-tease.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cartesi/cli": patch
---

ignore .env file when using cartesi run
11 changes: 11 additions & 0 deletions apps/cli/src/commands/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,13 @@ export default class Run extends BaseCommand<typeof Run> {
process.on("SIGINT", () => {});

try {
// mask .env
if (fs.existsSync("./.env")) {
this.warn(
"Ignoring .env file. You should create a .cartesi.env if you want to set environment variables for the rollups-node.",
);
await fs.rename(".env", ".masked.env");
}
// run compose environment
await execa("docker", [...compose_args, "up", ...up_args], {
env,
Expand All @@ -156,6 +163,10 @@ export default class Run extends BaseCommand<typeof Run> {
env,
stdio: "inherit",
});
// unmask .env
if (fs.existsSync("./.masked.env")) {
await fs.rename(".masked.env", ".env");
}
}
}
}

0 comments on commit 64af221

Please sign in to comment.