diff --git a/Cargo.lock b/Cargo.lock index 2689050..b124f18 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -535,6 +535,15 @@ dependencies = [ "wit-bindgen-rt 0.42.1", ] +[[package]] +name = "fern" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4316185f709b23713e41e3195f90edef7fb00c3ed4adc79769cf09cc762a3b29" +dependencies = [ + "log", +] + [[package]] name = "fnv" version = "1.0.7" @@ -1661,8 +1670,10 @@ dependencies = [ name = "trusted-server-fastly" version = "0.1.0" dependencies = [ + "chrono", "error-stack", "fastly", + "fern", "futures", "log", "log-fastly", diff --git a/crates/common/src/gam.rs b/crates/common/src/gam.rs index bd42ac0..18e71e7 100644 --- a/crates/common/src/gam.rs +++ b/crates/common/src/gam.rs @@ -206,7 +206,7 @@ impl GamRequest { } Ok(Response::from_status(response.get_status()) - .with_header(header::CONTENT_TYPE, "application/json") + .with_header(header::CONTENT_TYPE, "text/plain") .with_header(header::CACHE_CONTROL, "no-store, private") .with_header(header::ACCESS_CONTROL_ALLOW_ORIGIN, "*") .with_header("X-GAM-Test", "true") diff --git a/crates/fastly/Cargo.toml b/crates/fastly/Cargo.toml index d98e2b5..618bd06 100644 --- a/crates/fastly/Cargo.toml +++ b/crates/fastly/Cargo.toml @@ -4,8 +4,10 @@ version = "0.1.0" edition = "2021" [dependencies] +chrono = "0.4.41" error-stack = "0.5" fastly = "0.11.5" +fern = "0.7.1" futures = "0.3" log = "0.4.20" log-fastly = "0.11.5" diff --git a/crates/fastly/src/main.rs b/crates/fastly/src/main.rs index 77cb614..5fb31cf 100644 --- a/crates/fastly/src/main.rs +++ b/crates/fastly/src/main.rs @@ -5,6 +5,7 @@ use fastly::http::{header, Method, StatusCode}; use fastly::KVStore; use fastly::{Error, Request, Response}; use log::LevelFilter::Info; +use log_fastly::Logger; use serde_json::json; mod error; @@ -34,6 +35,8 @@ use trusted_server_common::why::WHY_TEMPLATE; #[fastly::main] fn main(req: Request) -> Result { + init_logger(); + // Print Settings only once at the beginning let settings = match Settings::new() { Ok(s) => s, @@ -155,8 +158,6 @@ fn handle_main_page(settings: &Settings, mut req: Request) -> Result Result) + .apply() + .expect("Failed to initialize logger"); +} diff --git a/trusted-server.toml b/trusted-server.toml index 0a3c3b2..af98e50 100644 --- a/trusted-server.toml +++ b/trusted-server.toml @@ -1,7 +1,7 @@ [publisher] -domain = "test-publisher.com" -cookie_domain = ".test-publisher.com" -origin_url = "https://origin.test-publisher.com" +domain = "auburndao.com" +cookie_domain = ".auburndao.com" +origin_url = "https://origin.auburndao.com" [ad_server] ad_partner_url = "equativ_ad_api_2"