Skip to content

Commit 0ea9bc6

Browse files
committed
feat: add environment configuration schema for subgraph
1 parent 2674849 commit 0ea9bc6

File tree

2 files changed

+25
-17
lines changed

2 files changed

+25
-17
lines changed

packages/subgraph/.env.template

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
1-
# environment to use for configuration (prod/staging)
2-
ENV=prod
1+
# The name of the network (e.g., mainnet, arbitrum, etc.)
2+
NETWORK_NAME=...
33

4-
# override the starting block for indexation of all contracts events
5-
# START_BLOCK=0
4+
# The URL of the Graph Node endpoint for self-hosted Graph Node
5+
GRAPHNODE_URL=...
66

7-
# AppRegistry contract address override
8-
# APP_REGISTRY_ADDRESS=0x...
7+
# The URL of the IPFS endpoint for self-hosted IPFS
8+
IPFS_URL=...
99

10-
# DatasetRegistry contract address override
11-
# DATASET_REGISTRY_ADDRESS=0x...
12-
13-
# Dataprotector contract address override
14-
# DATAPROTECTOR_ADDRESS=0x...
15-
16-
# DataprotectorSharing contract address override
17-
# DATAPROTECTOR_SHARING_ADDRESS=0x...
18-
19-
# AddOnlyAppWhitelistRegistry contract address override
20-
# ADD_ONLY_APP_WHITELIST_REGISTRY_ADDRESS=0x...
10+
# The version label for the deployment (e.g., v1.0.0)
11+
VERSION_LABEL=...

packages/subgraph/config/env.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import 'dotenv/config';
2+
import { z } from 'zod';
3+
4+
const envSchema = z.object({
5+
NETWORK_NAME: z.string().min(1, 'NETWORK_NAME is required').default('bellecour'),
6+
7+
GRAPHNODE_URL: z
8+
.string()
9+
.url('GRAPHNODE_URL must be a valid URL')
10+
.default('http://localhost:8020'),
11+
12+
IPFS_URL: z.string().url('IPFS_URL must be a valid URL').default('http://localhost:5001'),
13+
14+
VERSION_LABEL: z.string().min(1, 'VERSION_LABEL is required').default('bellecour/poco-v5'),
15+
});
16+
17+
export const env = envSchema.parse(process.env);

0 commit comments

Comments
 (0)