Skip to content

Commit eab550d

Browse files
committed
core,node,server: move opt to core and add graphman config check to graphql api
1 parent 605eb53 commit eab550d

File tree

14 files changed

+90
-3
lines changed

14 files changed

+90
-3
lines changed

Cargo.lock

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/graphman/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@ edition.workspace = true
55

66
[dependencies]
77
anyhow = { workspace = true }
8+
async-graphql = { workspace = true }
9+
clap = { workspace = true }
810
diesel = { workspace = true }
11+
git-testament = "0.2"
912
graph = { workspace = true }
1013
graph-store-postgres = { workspace = true }
1114
graphman-store = { workspace = true }
1215
itertools = { workspace = true }
16+
lazy_static = "1.5.0"
1317
thiserror = { workspace = true }
1418
tokio = { workspace = true }
1519
graph-chain-ethereum = { path = "../../chain/ethereum" }

core/graphman/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pub mod commands;
1111
pub mod config;
1212
pub mod deployment;
1313
pub mod execution_tracker;
14+
pub mod opt;
1415

1516
pub use self::error::GraphmanError;
1617
pub use self::execution_tracker::GraphmanExecutionTracker;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use clap::Parser;
22
use git_testament::{git_testament, render_testament};
33
use lazy_static::lazy_static;
44

5-
use graphman::config;
5+
use crate::config;
66

77
git_testament!(TESTAMENT);
88
lazy_static! {

node/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ extern crate diesel;
77

88
pub mod chain;
99
pub mod network_setup;
10-
pub mod opt;
1110
pub mod store_builder;
1211

1312
pub mod manager;

node/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use graph_core::{
2121
};
2222
use graph_graphql::prelude::GraphQlRunner;
2323
use graph_node::network_setup::Networks;
24-
use graph_node::opt;
2524
use graph_node::store_builder::StoreBuilder;
2625
use graph_server_http::GraphQLServer as GraphQLQueryServer;
2726
use graph_server_index_node::IndexNodeServer;
@@ -32,6 +31,7 @@ use graph_store_postgres::connection_pool::ConnectionPool;
3231
use graph_store_postgres::Store;
3332
use graph_store_postgres::{register_jobs as register_store_jobs, NotificationSender};
3433
use graphman::config::Config;
34+
use graphman::opt;
3535
use graphman_server::GraphmanServer;
3636
use graphman_server::GraphmanServerConfig;
3737
use std::io::{BufRead, BufReader};

server/graphman/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ async-graphql = { workspace = true }
99
async-graphql-axum = { workspace = true }
1010
axum = { workspace = true }
1111
chrono = { workspace = true }
12+
clap = { workspace = true }
1213
graph = { workspace = true }
1314
graph-store-postgres = { workspace = true }
1415
graphman = { workspace = true }
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
use async_graphql::SimpleObject;
2+
3+
#[derive(Clone, Debug, SimpleObject)]
4+
pub struct ConfigCheckResponse {
5+
/// Checks if the config file is validated.
6+
pub config_validated: bool,
7+
/// Checks if the subgraph settings config set by GRAPH_EXPERIMENTAL_SUBGRAPH_SETTINGS are validated.
8+
pub subgraph_settings_validated: bool,
9+
/// Returns the Config file as a string.
10+
pub config: String,
11+
}
12+
13+
impl ConfigCheckResponse {
14+
pub fn from(config_validated: bool, subgraph_settings_validated: bool, config: String) -> Self {
15+
Self {
16+
config_validated,
17+
subgraph_settings_validated,
18+
config,
19+
}
20+
}
21+
}

server/graphman/src/entities/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ mod block_hash;
22
mod block_number;
33
mod block_ptr;
44
mod command_kind;
5+
mod config_check;
56
mod deployment_info;
67
mod deployment_selector;
78
mod deployment_status;
@@ -15,6 +16,7 @@ pub use self::block_hash::BlockHash;
1516
pub use self::block_number::BlockNumber;
1617
pub use self::block_ptr::BlockPtr;
1718
pub use self::command_kind::CommandKind;
19+
pub use self::config_check::ConfigCheckResponse;
1820
pub use self::deployment_info::DeploymentInfo;
1921
pub use self::deployment_selector::DeploymentSelector;
2022
pub use self::deployment_status::DeploymentStatus;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
use async_graphql::Context;
2+
use async_graphql::Object;
3+
use async_graphql::Result;
4+
5+
use crate::entities::ConfigCheckResponse;
6+
7+
mod check;
8+
pub struct ConfigQuery;
9+
10+
#[Object]
11+
impl ConfigQuery {
12+
/// Check and validate the configuration file
13+
pub async fn check(&self, ctx: &Context<'_>) -> Result<ConfigCheckResponse> {
14+
check::run(ctx)
15+
}
16+
}

0 commit comments

Comments
 (0)