Skip to content

Commit

Permalink
Merge branch 'release/v0.13.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
ja573 committed Nov 25, 2024
2 parents 2cac44f + e01b85a commit 7220df4
Show file tree
Hide file tree
Showing 14 changed files with 180 additions and 78 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [[0.13.1]](https://github.com/thoth-pub/thoth/releases/tag/v0.13.1) - 2024-11-25
### Added
- [593](https://github.com/thoth-pub/thoth/issues/593) - Log GraphQL queries alongside request logs

## [[0.13.0]](https://github.com/thoth-pub/thoth/releases/tag/v0.13.0) - 2024-11-19
### Added
- [651](https://github.com/thoth-pub/thoth/pull/651) - Implement Redis connection pools using `deadpool-redis`
Expand Down
57 changes: 29 additions & 28 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "thoth"
version = "0.13.0"
version = "0.13.1"
authors = ["Javier Arias <[email protected]>", "Ross Higman <[email protected]>"]
edition = "2021"
license = "Apache-2.0"
Expand All @@ -15,11 +15,11 @@ maintenance = { status = "actively-developed" }
members = ["thoth-api", "thoth-api-server", "thoth-app", "thoth-app-server", "thoth-client", "thoth-errors", "thoth-export-server"]

[dependencies]
thoth-api = { version = "=0.13.0", path = "thoth-api", features = ["backend"] }
thoth-api-server = { version = "=0.13.0", path = "thoth-api-server" }
thoth-app-server = { version = "=0.13.0", path = "thoth-app-server" }
thoth-errors = { version = "=0.13.0", path = "thoth-errors" }
thoth-export-server = { version = "=0.13.0", path = "thoth-export-server" }
thoth-api = { version = "=0.13.1", path = "thoth-api", features = ["backend"] }
thoth-api-server = { version = "=0.13.1", path = "thoth-api-server" }
thoth-app-server = { version = "=0.13.1", path = "thoth-app-server" }
thoth-errors = { version = "=0.13.1", path = "thoth-errors" }
thoth-export-server = { version = "=0.13.1", path = "thoth-export-server" }
clap = { version = "4.5.16", features = ["cargo", "env"] }
dialoguer = { version = "0.11.0", features = ["password"] }
dotenv = "0.15.0"
Expand Down
10 changes: 6 additions & 4 deletions thoth-api-server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "thoth-api-server"
version = "0.13.0"
version = "0.13.1"
authors = ["Javier Arias <[email protected]>", "Ross Higman <[email protected]>"]
edition = "2021"
license = "Apache-2.0"
Expand All @@ -9,13 +9,15 @@ repository = "https://github.com/thoth-pub/thoth"
readme = "README.md"

[dependencies]
thoth-api = { version = "=0.13.0", path = "../thoth-api", features = ["backend"] }
thoth-errors = { version = "=0.13.0", path = "../thoth-errors" }
thoth-api = { version = "=0.13.1", path = "../thoth-api", features = ["backend"] }
thoth-errors = { version = "=0.13.1", path = "../thoth-errors" }
actix-web = "4.9"
actix-cors = "0.7.0"
actix-http = "3.9.0"
actix-identity = "0.7.1"
actix-session = { version = "0.9.0", features = ["cookie-session"] }
env_logger = "0.11.5"
juniper = "0.16.1"
futures-util = "0.3.31"
log = "0.4.21"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
4 changes: 2 additions & 2 deletions thoth-api-server/src/graphiql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ pub fn graphiql_source(graphql_endpoint_url: &str) -> String {
<script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/[email protected]/graphiql.min.js" type="application/javascript"></script>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/graphiql.min.css" />
<script crossorigin src="https://unpkg.com/@graphiql/plugin-explorer@2/dist/index.umd.js"></script>
<link rel="stylesheet" href="https://unpkg.com/@graphiql/plugin-explorer@2/dist/style.css"/>
<script crossorigin src="https://unpkg.com/@graphiql/plugin-explorer@3/dist/index.umd.js"></script>
<link rel="stylesheet" href="https://unpkg.com/@graphiql/plugin-explorer@3/dist/style.css"/>
<style>
.graphiql-container,
.CodeMirror-info,
Expand Down
42 changes: 21 additions & 21 deletions thoth-api-server/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,36 +1,34 @@
mod graphiql;
mod logger;

use std::time::Duration;
use std::{io, sync::Arc};
use std::{io, sync::Arc, time::Duration};

use actix_cors::Cors;
use actix_identity::{Identity, IdentityMiddleware};
use actix_session::config::PersistentSession;
use actix_session::{storage::CookieSessionStore, SessionMiddleware};
use actix_session::{config::PersistentSession, storage::CookieSessionStore, SessionMiddleware};
use actix_web::{
cookie::time::Duration as CookieDuration, cookie::Key, error, get, http::header,
middleware::Logger, post, web::Data, web::Json, App, Error, HttpMessage, HttpRequest,
HttpResponse, HttpServer, Result,
cookie::{time::Duration as CookieDuration, Key},
error, get,
http::header,
middleware::Compress,
post,
web::{Data, Json},
App, Error, HttpMessage, HttpRequest, HttpResponse, HttpServer, Result,
};
use juniper::http::GraphQLRequest;
use serde::Serialize;
use thoth_api::{
account::model::AccountDetails,
account::model::DecodedToken,
account::model::LoginCredentials,
account::service::get_account,
account::service::get_account_details,
account::service::login,
db::init_pool,
db::PgPool,
graphql::model::Context,
graphql::model::{create_schema, Schema},
account::model::{AccountDetails, DecodedToken, LoginCredentials},
account::service::{get_account, get_account_details, login},
db::{init_pool, PgPool},
graphql::{
model::{create_schema, Context, Schema},
GraphQLRequest,
},
};
use thoth_errors::ThothError;

use crate::graphiql::graphiql_source;

const LOG_FORMAT: &str = r#"%{r}a %a "%r" %s %b "%{Referer}i" "%{User-Agent}i" %T"#;
use crate::logger::{BodyLogger, Logger};

#[derive(Serialize)]
struct ApiConfig {
Expand Down Expand Up @@ -201,7 +199,9 @@ pub async fn start_server(

HttpServer::new(move || {
App::new()
.wrap(Logger::new(LOG_FORMAT))
.wrap(Compress::default())
.wrap(Logger::default())
.wrap(BodyLogger)
.wrap(IdentityMiddleware::default())
.wrap(
SessionMiddleware::builder(
Expand Down
Loading

0 comments on commit 7220df4

Please sign in to comment.