Skip to content

Commit d46d84c

Browse files
authored
Make IPFS url configurable (#669)
1 parent c94e355 commit d46d84c

File tree

5 files changed

+6
-2
lines changed

5 files changed

+6
-2
lines changed

crates/config/default_values.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ recently_closed_allocation_buffer_secs = 3600
99
syncing_interval_secs = 60
1010

1111
[service]
12+
ipfs_url = "https://api.thegraph.com/ipfs/"
1213
serve_network_subgraph = false
1314
serve_escrow_subgraph = false
1415
host_and_port = "0.0.0.0:7600"
@@ -26,4 +27,3 @@ trigger_value_divisor = 10
2627
timestamp_buffer_secs = 60
2728
request_timeout_secs = 5
2829
max_receipts_per_request = 10000
29-

crates/config/maximal-config-example.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ serve_escrow_subgraph = false
102102
# serve_auth_token = "token"
103103
## allow queries using this token
104104
# free_query_auth_token = "i-am-authorized-right?"
105+
ipfs_url = "https://api.thegraph.com/ipfs/"
105106

106107

107108
[service.tap]

crates/config/src/config.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ pub struct BlockchainConfig {
353353
#[derive(Debug, Deserialize)]
354354
#[cfg_attr(test, derive(PartialEq))]
355355
pub struct ServiceConfig {
356+
pub ipfs_url: Url,
356357
pub serve_network_subgraph: bool,
357358
pub serve_escrow_subgraph: bool,
358359
pub serve_auth_token: Option<String>,

crates/service/src/service.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ pub async fn run() -> anyhow::Result<()> {
102102

103103
let host_and_port = config.service.host_and_port;
104104
let indexer_address = config.indexer.indexer_address;
105+
let ipfs_url = config.service.ipfs_url.clone();
105106

106107
let router = ServiceRouter::builder()
107108
.database(database.clone())
@@ -135,7 +136,7 @@ pub async fn run() -> anyhow::Result<()> {
135136
.expect("invalid dips host port");
136137

137138
let ipfs_fetcher: Arc<dyn IpfsFetcher> =
138-
Arc::new(IpfsClient::new("https://api.thegraph.com/ipfs/").unwrap());
139+
Arc::new(IpfsClient::new(ipfs_url.as_str()).unwrap());
139140

140141
// TODO: Try to re-use the same watcher for both DIPS and TAP
141142
let watcher = escrow_accounts_v1(

crates/service/tests/router_test.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ async fn full_integration_test(database: PgPool) {
8484
max_receipt_value_grt: NonZeroGRT::new(1000000000000).unwrap(),
8585
},
8686
free_query_auth_token: None,
87+
ipfs_url: "http://localhost:5001".parse().unwrap(),
8788
})
8889
.blockchain(BlockchainConfig {
8990
chain_id: indexer_config::TheGraphChainId::Test,

0 commit comments

Comments
 (0)