Skip to content

Commit 90e2c3a

Browse files
Add that now deploy also accepts the --network and --network-file options (#162)
* Add that now deploy also accepts the network options * Update headings * Fix typo. Add note about deploy * Fix typo
1 parent 912471e commit 90e2c3a

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

pages/en/deploying/deploying-a-subgraph-to-hosted.mdx

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,25 +102,23 @@ If your previously deployed subgraph is still in status `Syncing`, it will be im
102102

103103
In some cases, you will want to deploy the same subgraph to multiple Ethereum networks without duplicating all of its code. The main challenge that comes with this is that the contract addresses on these networks are different.
104104

105-
### graph-cli >=0.29.0
105+
### Using graph-cli
106106

107-
From version `0.29.0` the `build` command accepts two new options:
107+
Both `graph build` (since `v0.29.0`) and `graph deploy` (since `v0.32.0`) accept two new options:
108108

109109
```sh
110-
graph build [options] [<subgraph-manifest>]
111-
112110
Options:
113111

114112
...
115-
--network <name> Network to use from networks.json
116-
--network-file <path> Networks file (default: "./networks.json")
113+
--network <name> Network configuration to use from the networks config file
114+
--network-file <path> Networks config file path (default: "./networks.json")
117115
```
118116

119117
You can use the `--network` option to specify a network configuration from a `json` standard file (defaults to `networks.json`) to easily update your subgraph during development.
120118

121119
**Note:** The `init` command will now auto-generate a `networks.json` based on the provided information. You will then be able to update existing or add additional networks.
122120

123-
If you don't have a `networks.json` file, you'll need to manually create one with the follwing structure:
121+
If you don't have a `networks.json` file, you'll need to manually create one with the following structure:
124122

125123
```json
126124
{
@@ -182,7 +180,7 @@ This is what your networks config file should look like:
182180
}
183181
```
184182

185-
Now we can run the following command:
183+
Now we can run one of the following commands:
186184

187185
```sh
188186
# Using default networks.json file
@@ -207,9 +205,19 @@ dataSources:
207205
kind: ethereum/events
208206
```
209207
210-
Now you are ready to `yarn deploy`
208+
Now you are ready to `yarn deploy`.
209+
210+
**Note:** As mentioned earlier, since `graph-cli 0.32.0` you can directly run `yarn deploy` with the `--network` option:
211+
212+
```sh
213+
# Using default networks.json file
214+
yarn deploy --network ropsten
215+
216+
# Using custom named file
217+
yarn deploy --network ropsten --network-file path/to/config
218+
```
211219

212-
### graph-cli \<0.29.0
220+
### Using subgraph.yaml template
213221

214222
One solution for older graph-cli versions that allows to parameterize aspects like contract addresses is to generate parts of it using a templating system like [Mustache](https://mustache.github.io/) or [Handlebars](https://handlebarsjs.com/).
215223

0 commit comments

Comments
 (0)