chore(network-subgraphs): Template for subgraph.yaml
#1016
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Extracted subgraph configs (mainly contract addresses and
startBlock
values) to a separatesubgraph-config.json
file. Now the actualsubgraph.yaml
is generated inbuild.sh
by filling the config options to a Handlebars template.We don't need separate environment specific
subgraph_* yaml
files anymore.Implementation
There is a small
fill-handlebars-template.mjs
script which reads the config fromstdin
and outputs the filled template tostdout
. There is no custom logic in that script, and alternative we could use some ready-made external Handlebars utility instead of this script.Config file
The config file was generated from the existing
subgraph_*.yaml
files by this script:Small changes to subgraph.yaml output
The subgraph.yaml output generated by the
build.sh
matches almost exactly the current files. Exceptions:See three commits in this PR for the exact unifications. There was also test.sh script in commit bda37c6 to check that the outputs match the current files.
Notes about Iotex
Thet addresses in the
subgraph-config.json
matches the addresses which were used insubgraph_iotex.yaml
, but don't match the values of@streamr/config
. Therefore this PR doesn't change any functionality. There is a separate PR about this #1010 issue.Also in that PR or in a follow-up PR we may add hub contracts to
iotex
config. If we do that we should remove thehubContracts
property from thesubgraph-configs.json
(and the related if statement insubgraph.yaml.hbs
) as the value for that is true in environment.s