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 Sep 19, 2024
1 parent 3a58ad0 commit f206f9d
Show file tree
Hide file tree
Showing 2 changed files with 17 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
12 changes: 12 additions & 0 deletions apps/cli/src/commands/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,14 @@ 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");
}

if (flags["dry-run"]) {
// show the docker compose configuration
await execa("docker", [...compose_args, "config"], {
Expand All @@ -217,6 +225,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 f206f9d

Please sign in to comment.