Skip to content

Commit

Permalink
Docs Env Support (#507)
Browse files Browse the repository at this point in the history
* added env support docs in quickstart guide

* added bulid script info

* Update quickstart.md
  • Loading branch information
AK46rocks authored Apr 15, 2024
1 parent d94db24 commit f88ff86
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions docs/indexer/quickstart/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,42 @@ For example, to create the [Ethereum Gravatar indexer](./quickstart_chains/ether
Once completed, you will have a scaffold project structure from your chosen ABI `functions`/`events`.

You can read more about this feature in [Project Scaffolding](../build/introduction.md#evm-project-scaffolding)

## ENV Support

SubQuery provides support for environment variables to configure your project dynamically. This enables flexibility in managing different configurations for development, testing, and production environments.

To utilize environment variable support:

The .env files are automatically created when you initialize a project using the CLI. You can modify these files to adjust configurations according to your requirements.

```shell
# Example .env
ENDPOINT=https://polygon-rpc.com
CHAIN_ID=204
```

In your .env files, *CHAIN_ID* and provided *ENDPOINT* of your project are already added you can configure these variables to match your blockchain network settings. Additionally, you can keep sensitive information such as *CONTRACT_ADDRESS* from project.ts in your .env files for added security.

Multiple ENDPOINT can be added in .env file using comma separated.

```shell
ENDPOINT=https://polygon-rpc.com,https://polygon.llamarpc.com
```

The package.json file includes build scripts that allow you to build with either production (`.env`) or development (`.env.develop`).

```json
"scripts": {
"build": "subql codegen && subql build", // default is production
"build:develop": "NODE_ENV=develop subql codegen && NODE_ENV=develop subql build"
}
```
Use `build` script to generate artifacts using the default production .env settings.
Use `build:develop` script to generate artifacts using the development .env.develop settings.

Using environment variables and .env files provides a convenient way to manage project configurations and keep sensitive information secure.

Note: Ensure that .env files are included in your project's .gitignore to prevent them from being committed to version control and exposing sensitive information.

This documentation provides comprehensive guidance on utilizing environment variable support in SubQuery projects for better configurability and security.

0 comments on commit f88ff86

Please sign in to comment.