Skip to content
This repository has been archived by the owner on Jul 26, 2024. It is now read-only.

Commit

Permalink
f fix int-test #3
Browse files Browse the repository at this point in the history
  • Loading branch information
jrconlin committed Jul 28, 2021
1 parent 05158d5 commit 0734d41
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ jobs:
name: Run Integration tests
command: |
echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin
docker-compose --use-aliases -f docker-compose.yml run client
docker-compose --version
docker-compose -f docker-compose.yml run --use-aliases --rm client
workflows:
version: 2
Expand Down
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# Change this to be your application's name
ARG APPNAME=contile

FROM rust:1.52.1 as builder
# make sure that the build and run environments are the same version
FROM rust:1.53-slim-buster as builder
ARG APPNAME
ADD . /app
WORKDIR /app
Expand All @@ -12,6 +13,7 @@ WORKDIR /app
# ARG RUST_TOOLCHAIN=nightly
RUN \
apt-get -qq update && \
apt-get install libssl-dev pkg-config -y && \
\
rustup default ${RUST_TOOLCHAIN} && \
cargo --version && \
Expand All @@ -21,16 +23,16 @@ RUN \
cp /app/target/release/${APPNAME} /app/bin


FROM debian:stretch-slim
FROM debian:buster-slim
ARG APPNAME

# FROM debian:stretch # for debugging docker build
# FROM debian:buster # for debugging docker build
RUN \
groupadd --gid 10001 app && \
useradd --uid 10001 --gid 10001 --home /app --create-home app && \
\
apt-get -qq update && \
apt-get -qq install -y libssl-dev ca-certificates && \
apt-get -qq install -y libssl-dev pkg-config ca-certificates && \
rm -rf /var/lib/apt/lists

COPY --from=builder /app/bin /app/bin
Expand Down
5 changes: 5 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ services:
RUST_LOG: main,contile=INFO
volumes:
- ./tools/volumes/contile:/tmp/contile
## Report your IP address, then try running Contile
#entrypoint: >
# /bin/sh -c "hostname -I && bin/contile"
client:
image: mozilla/contile-integration-tests-client
#build: client
Expand All @@ -44,5 +47,7 @@ services:
SCENARIOS_FILE: /tmp/client/scenarios.yml
volumes:
- ./tools/volumes/client:/tmp/client
#entrypoint: >
# /bin/sh -c "apt update -y && apt install knot-dnsutils -y && hostname -I && kdig contile +short && kdig localhost +short"
command: >
"-vv"
1 change: 1 addition & 0 deletions src/adm/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ impl From<&mut Settings> for AdmSettings {
return serde_json::from_reader(f).expect("Invalid ADM Settings file");
}
}
dbg!(&settings);
let adm_settings: AdmSettings =
serde_json::from_str(&settings.adm_settings).expect("Invalid ADM Settings JSON string");
for (adv, filter_setting) in &adm_settings {
Expand Down
19 changes: 14 additions & 5 deletions src/server/img_storage.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
//! Fetch and store a given remote image into Google Storage for CDN caching
use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher};
///
use std::io::Cursor;
use std::time::Duration;
use std::{
collections::hash_map::DefaultHasher,
env,
hash::{Hash, Hasher},
io::Cursor,
time::Duration,
};

use actix_http::http::HeaderValue;
use actix_web::http::uri;
Expand Down Expand Up @@ -149,6 +151,13 @@ impl StoreImage {
settings: &StorageSettings,
client: &reqwest::Client,
) -> HandlerResult<Option<Self>> {
if env::var("SERVICE_ACCOUNT").is_err()
&& env::var("GOOGLE_APPLICATION_CREDENTIALS").is_err()
{
trace!("No auth credentials set. Not storing...");
return Ok(None);
}

// https://cloud.google.com/storage/docs/naming-buckets
// don't try to open an empty bucket
let empty = ["", "none"];
Expand Down

0 comments on commit 0734d41

Please sign in to comment.