Skip to content

Commit 212d272

Browse files
committed
Revert "node: Turn --readonly-db flag into an env var"
This reverts commit 258cd72.
1 parent 5ad902c commit 212d272

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

node/src/main.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,6 @@ lazy_static! {
5252
.map(|s| u64::from_str(&s)
5353
.unwrap_or_else(|_| panic!("failed to parse env var ETHEREUM_ANCESTOR_COUNT")))
5454
.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();
6355
}
6456

6557
git_testament!(TESTAMENT);
@@ -297,6 +289,12 @@ async fn main() {
297289
.value_name("URL")
298290
.help("HTTP endpoint for 3box profiles"),
299291
)
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+
)
300298
.get_matches();
301299

302300
// Set up logger
@@ -534,7 +532,9 @@ async fn main() {
534532
connection_pool_registry,
535533
);
536534

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 {
538538
None
539539
} else {
540540
Some(Arc::new(PostgresChainHeadUpdateListener::new(
@@ -544,7 +544,7 @@ async fn main() {
544544
)))
545545
};
546546

547-
let subscriptions = if *EXPERIMENTAL_READONLY_DB {
547+
let subscriptions = if readonly_db {
548548
None
549549
} else {
550550
Some(Arc::new(SubscriptionManager::new(
@@ -616,7 +616,7 @@ async fn main() {
616616

617617
// Disable the subscriptions server when running against a read-only
618618
// database
619-
if !*EXPERIMENTAL_READONLY_DB {
619+
if !readonly_db {
620620
let subscription_server = GraphQLSubscriptionServer::new(
621621
&logger,
622622
graphql_runner.clone(),
@@ -634,7 +634,7 @@ async fn main() {
634634
node_id.clone(),
635635
);
636636

637-
if !*EXPERIMENTAL_READONLY_DB {
637+
if !readonly_db {
638638
// Spawn Ethereum network indexers for all networks that are to be indexed
639639
if let Some(network_subgraphs) = matches.values_of("network-subgraphs") {
640640
network_subgraphs

0 commit comments

Comments
 (0)