@@ -52,14 +52,6 @@ lazy_static! {
52
52
. map( |s| u64 :: from_str( & s)
53
53
. unwrap_or_else( |_| panic!( "failed to parse env var ETHEREUM_ANCESTOR_COUNT" ) ) )
54
54
. unwrap_or( 50 ) ;
55
-
56
- // Run against a read-only database. This turns off a few things:
57
- // - Chain head listeners
58
- // - Store events
59
- // - Subscriptions and the WebSocket server
60
- // - The JSON-RPC admin server
61
- static ref EXPERIMENTAL_READONLY_DB : bool = env:: var( "GRAPH_EXPERIMENTAL_READONLY_DB" )
62
- . ok( ) . is_some( ) ;
63
55
}
64
56
65
57
git_testament ! ( TESTAMENT ) ;
@@ -297,6 +289,12 @@ async fn main() {
297
289
. value_name ( "URL" )
298
290
. help ( "HTTP endpoint for 3box profiles" ) ,
299
291
)
292
+ . arg (
293
+ Arg :: with_name ( "readonly-db" )
294
+ . takes_value ( false )
295
+ . long ( "readonly-db" )
296
+ . help ( "Run against a readonly db (no subscriptions etc.)" ) ,
297
+ )
300
298
. get_matches ( ) ;
301
299
302
300
// Set up logger
@@ -534,7 +532,9 @@ async fn main() {
534
532
connection_pool_registry,
535
533
) ;
536
534
537
- let chain_head_update_listener = if * EXPERIMENTAL_READONLY_DB {
535
+ let readonly_db = matches. is_present ( "readonly-db" ) ;
536
+
537
+ let chain_head_update_listener = if readonly_db {
538
538
None
539
539
} else {
540
540
Some ( Arc :: new ( PostgresChainHeadUpdateListener :: new (
@@ -544,7 +544,7 @@ async fn main() {
544
544
) ) )
545
545
} ;
546
546
547
- let subscriptions = if * EXPERIMENTAL_READONLY_DB {
547
+ let subscriptions = if readonly_db {
548
548
None
549
549
} else {
550
550
Some ( Arc :: new ( SubscriptionManager :: new (
@@ -616,7 +616,7 @@ async fn main() {
616
616
617
617
// Disable the subscriptions server when running against a read-only
618
618
// database
619
- if !* EXPERIMENTAL_READONLY_DB {
619
+ if !readonly_db {
620
620
let subscription_server = GraphQLSubscriptionServer :: new (
621
621
& logger,
622
622
graphql_runner. clone ( ) ,
@@ -634,7 +634,7 @@ async fn main() {
634
634
node_id. clone ( ) ,
635
635
) ;
636
636
637
- if !* EXPERIMENTAL_READONLY_DB {
637
+ if !readonly_db {
638
638
// Spawn Ethereum network indexers for all networks that are to be indexed
639
639
if let Some ( network_subgraphs) = matches. values_of ( "network-subgraphs" ) {
640
640
network_subgraphs
0 commit comments