Skip to content
Snippets Groups Projects
Commit d2c46fbd authored by Éloïs's avatar Éloïs
Browse files

feat(conf): add config param playground_path

parent 3d9e3ffe
No related branches found
No related tags found
No related merge requests found
Pipeline #12638 passed
......@@ -34,6 +34,8 @@ pub struct GvaConf {
pub port: u16,
#[serde(default = "path_default")]
pub path: String,
#[serde(default = "playground_path_default")]
pub playground_path: String,
#[serde(default = "subscriptions_path_default")]
pub subscriptions_path: String,
pub remote_host: Option<String>,
......@@ -57,6 +59,10 @@ fn path_default() -> String {
"gva".to_owned()
}
fn playground_path_default() -> String {
"gva-playground".to_owned()
}
const fn port_default() -> u16 {
30_901
}
......@@ -79,6 +85,7 @@ impl Default for GvaConf {
ip4: ip4_default(),
ip6: Some(ip6_default()),
port: port_default(),
playground_path: playground_path_default(),
path: path_default(),
subscriptions_path: subscriptions_path_default(),
remote_host: None,
......
......@@ -277,18 +277,16 @@ impl GvaModule {
);
let conf_clone = conf.clone();
let graphql_playground =
warp::path::path(conf.path.clone())
let graphql_playground = warp::path::path(conf.playground_path.clone())
.and(warp::get())
.map(move || {
HttpResponse::builder()
.header("content-type", "text/html")
.body(async_graphql::http::playground_source(
GraphQLPlaygroundConfig::new(&format!("/{}", &conf_clone.path))
.subscription_endpoint(&format!(
"/{}",
&conf_clone.subscriptions_path,
)),
.subscription_endpoint(
&format!("/{}", &conf_clone.subscriptions_path,),
),
))
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment