Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): ignore .env file for cartesi run #61

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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 @@ -208,7 +216,7 @@
});
} catch (e: unknown) {
// 130 is a graceful shutdown, so we can swallow it
if ((e as any).exitCode !== 130) {

Check warning on line 219 in apps/cli/src/commands/run.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
throw e;
}
} finally {
Expand All @@ -217,6 +225,10 @@
env,
stdio: "inherit",
});
// unmask .env
if (fs.existsSync("./.masked.env")) {
await fs.rename(".masked.env", ".env");
}
}
}
}
Loading