subql icon indicating copy to clipboard operation
subql copied to clipboard

[Feature Request] Support env file & env commend.

Open HuberTRoy opened this issue 1 year ago • 0 comments

Prerequisites

  • [x] Are you running the latest version(s)?
  • [x] Have you searched the documentation for your issue?
  • [x] Did you search for an existing issue or pull request?

Description

When I develop a project, I want to test on Polygon & Mumbai. I created two config file project.ts & project.mainnet.ts. Those two files only have some fields different. So support env file would be good in project.

I use dotenv locally for this feature. If subql can supply an out of box way may good to use.

Expect

The files looks like this:

-.env
-.env.local # git ignore it, override the fields 
-.env.develop
-.env.develop.local # git ignore it
project.ts

In project.ts, I can use it for different data:

const project: EthereumProject = {
   .....
  network: {
    chainId: process.env.chainId,
    endpoint: [process.env.endpoint],
  },

In package.json:

    "build": "subql codegen && subql build", // default is production
    "build:develop": "subql codegen --mode develop && subql build --mode develop",

HuberTRoy avatar Jan 12 '24 09:01 HuberTRoy