From f0860f937d0932714a23a21bd2bb11acec5eda41 Mon Sep 17 00:00:00 2001 From: jkuznik Date: Thu, 21 Nov 2024 14:02:33 +0100 Subject: [PATCH] Fix env variable using way in docker container, update RiskAssessment --- .github/workflows/self-host-CD.yml | 10 ++++++---- .../airiskassessment/RiskAssessmentService.java | 2 +- src/main/resources/application-dev.yml | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/self-host-CD.yml b/.github/workflows/self-host-CD.yml index be87fbd5..fd8de466 100644 --- a/.github/workflows/self-host-CD.yml +++ b/.github/workflows/self-host-CD.yml @@ -23,11 +23,13 @@ jobs: TWILIO_AUTH_TOKEN: ${{secrets.TWILIO_AUTH_TOKEN}} TWILIO_PHONE_NUMBER: ${{secrets.TWILIO_PHONE_NUMBER}} OPENAI_API_KEY: ${{secrets.OPENAI_API_KEY}} + DAY_SMS_LIMIT: 5 run: sudo docker run -d -p 8080:8080 \ --name disaster-alert-container \ --network disaster-net \ - -e TWILIO_ACCOUNT_SID=${{secrets.TWILIO_ACCOUNT_SID}} \ - -e TWILIO_AUTH_TOKEN=${{secrets.TWILIO_AUTH_TOKEN}} \ - -e TWILIO_PHONE_NUMBER=${{secrets.TWILIO_PHONE_NUMBER}} \ - -e OPENAI_API_KEY=${{secrets.OPENAI_API_KEY}} \ + -e TWILIO_ACCOUNT_SID=$TWILIO_ACCOUNT_SID \ + -e TWILIO_AUTH_TOKEN=$TWILIO_AUTH_TOKEN \ + -e TWILIO_PHONE_NUMBER=$TWILIO_PHONE_NUMBER \ + -e OPENAI_API_KEY=$OPENAI_API_KEY \ + -e DAY_SMS_LIMIT=$DAY_SMS_LIMIT \ jkuznik/disaster-alert \ No newline at end of file diff --git a/src/main/java/pl/ateam/disasteralerts/airiskassessment/RiskAssessmentService.java b/src/main/java/pl/ateam/disasteralerts/airiskassessment/RiskAssessmentService.java index 9ebfbbca..c33fec8f 100644 --- a/src/main/java/pl/ateam/disasteralerts/airiskassessment/RiskAssessmentService.java +++ b/src/main/java/pl/ateam/disasteralerts/airiskassessment/RiskAssessmentService.java @@ -10,7 +10,7 @@ @Slf4j class RiskAssessmentService { - public static final double RISK_THRESHOLD = 0.7; + public static final double RISK_THRESHOLD = 0.3; private final OpenAIClient openAIClient; boolean assessRisk(DisasterAddDTO disasterAddDTO) { diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index a865fa92..25fd2f87 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -27,7 +27,7 @@ spring: ai: openai: - api-key: "${{ secrets.OPENAI_API_KEY }}" + api-key: ${OPENAI_API_KEY} chat: options: model: gpt-4o