Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion crates/common/src/gam.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 2 additions & 0 deletions crates/fastly/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
27 changes: 25 additions & 2 deletions crates/fastly/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
use fastly::http::{header, Method, StatusCode};
use fastly::KVStore;
use fastly::{Error, Request, Response};
use log::LevelFilter::Info;

Check failure on line 7 in crates/fastly/src/main.rs

View workflow job for this annotation

GitHub Actions / cargo test

unused import: `log::LevelFilter::Info`

Check failure on line 7 in crates/fastly/src/main.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

unused import: `log::LevelFilter::Info`
use log_fastly::Logger;
use serde_json::json;

mod error;
Expand Down Expand Up @@ -34,6 +35,8 @@

#[fastly::main]
fn main(req: Request) -> Result<Response, Error> {
init_logger();

// Print Settings only once at the beginning
let settings = match Settings::new() {
Ok(s) => s,
Expand Down Expand Up @@ -155,8 +158,6 @@
settings.synthetic.counter_store,
);

log_fastly::init_simple("mylogs", Info);

// Add DMA code check to main page as well
let dma_code = get_dma_code(&mut req);
log::info!("Main page - DMA Code: {:?}", dma_code);
Expand Down Expand Up @@ -633,3 +634,25 @@
}
}
}

fn init_logger() {
let logger = Logger::builder()
.default_endpoint("tslog")
.echo_stdout(true)
.max_level(log::LevelFilter::Debug)
.build()
.expect("Failed to build Logger");

fern::Dispatch::new()
.format(|out, message, record| {
out.finish(format_args!(
"{} {} {}",
chrono::Local::now().to_rfc3339_opts(chrono::SecondsFormat::Millis, true),
record.level(),
message
))
})
.chain(Box::new(logger) as Box<dyn log::Log>)
.apply()
.expect("Failed to initialize logger");
}
6 changes: 3 additions & 3 deletions trusted-server.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
Loading