From e5973cea54c627df3ec698e80e39f3b85389d49b Mon Sep 17 00:00:00 2001 From: Muskan Paliwal Date: Sat, 14 Oct 2023 12:21:23 +0530 Subject: [PATCH] made the code running, can access auth_info from github app --- Dockerfile | 9 +++++++++ vibi-dpu/src/github/auth.rs | 5 ++--- vibi-dpu/src/setup/setup_gh.rs | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index e275252c..9124d366 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,6 +19,10 @@ ARG BITBUCKET_CLIENT_SECRET ARG BITBUCKET_BASE_URL ARG INSTALL_ID ARG SERVER_URL +ARG GITHUB_CLIENT_ID +ARG GITHUB_CLIENT_SECRET +ARG GITHUB_BASE_URL +ARG GITHUB_APP_ID ENV GCP_CREDENTIALS=$GCP_CREDENTIALS @@ -29,9 +33,14 @@ ENV BITBUCKET_CLIENT_SECRET=$BITBUCKET_CLIENT_SECRET ENV BITBUCKET_BASE_URL=$BITBUCKET_BASE_URL ENV INSTALL_ID=$INSTALL_ID ENV SERVER_URL=$SERVER_URL +ENV GITHUB_CLIENT_ID=$GITHUB_CLIENT_ID +ENV GITHUB_CLIENT_SECRET=$GITHUB_CLIENT_SECRET +ENV GITHUB_BASE_URL=$GITHUB_BASE_URL +ENV GITHUB_APP_ID=$GITHUB_APP_ID COPY ./vibi-dpu/target/debug/vibi-dpu /app/vibi-dpu COPY ./pubsub-sa-test.json /app/pubsub-sa.json +COPY ./repoprofiler_private.pem /app/repoprofiler_private.pem # Start the Rust application CMD ["/app/vibi-dpu"] diff --git a/vibi-dpu/src/github/auth.rs b/vibi-dpu/src/github/auth.rs index 2574d4e0..3229c0a7 100644 --- a/vibi-dpu/src/github/auth.rs +++ b/vibi-dpu/src/github/auth.rs @@ -20,9 +20,8 @@ struct Claims { } fn generate_jwt(github_app_id: &str) -> Result> { - let pem_file_path = "/tmp/repoprofiler_private.pem"; + let pem_file_path = "/app/repoprofiler_private.pem"; let pem_data = fs::read(pem_file_path)?; - let my_claims = Claims { iat: Utc::now().timestamp(), exp: (Utc::now() + Duration::minutes(5)).timestamp(), @@ -31,7 +30,6 @@ fn generate_jwt(github_app_id: &str) -> Result Result