diff --git a/.changeset/short-hairs-tease.md b/.changeset/short-hairs-tease.md new file mode 100644 index 00000000..0b2b2fbf --- /dev/null +++ b/.changeset/short-hairs-tease.md @@ -0,0 +1,5 @@ +--- +"@cartesi/cli": patch +--- + +ignore .env file when using cartesi run diff --git a/apps/cli/src/commands/run.ts b/apps/cli/src/commands/run.ts index 4dd12bb6..e11d08dc 100644 --- a/apps/cli/src/commands/run.ts +++ b/apps/cli/src/commands/run.ts @@ -192,6 +192,14 @@ export default class Run extends BaseCommand { 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"], { @@ -217,6 +225,10 @@ export default class Run extends BaseCommand { env, stdio: "inherit", }); + // unmask .env + if (fs.existsSync("./.masked.env")) { + await fs.rename(".masked.env", ".env"); + } } } }