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 1b89ef73..73758bc2 100644 --- a/apps/cli/src/commands/run.ts +++ b/apps/cli/src/commands/run.ts @@ -140,6 +140,13 @@ 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"); + } // run compose environment await execa("docker", [...compose_args, "up", ...up_args], { env, @@ -156,6 +163,10 @@ export default class Run extends BaseCommand { env, stdio: "inherit", }); + // unmask .env + if (fs.existsSync("./.masked.env")) { + await fs.rename(".masked.env", ".env"); + } } } }