From cf262e376e4dd68e32f292a46ed5c59667f9bd0f Mon Sep 17 00:00:00 2001
From: Ryan Melvin <rmelvin@uabmc.edu>
Date: Tue, 30 May 2023 14:10:17 -0500
Subject: [PATCH] secrets for local streamlit

---
 README.md         | 6 ++++--
 app.py            | 4 ++++
 deploy/Dockerfile | 2 +-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 55f5f76..8132a23 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@ Uses OpenAI API to determine if a research idea is reasonable and novel for the
 ## Deploy
 ### Docker-compose
 ```
-docker-compose up
+docker-compose up --rebuild --force=recreate
 ```
 
 You can use the `-d` flag at the end to runin in detached (background) mode
@@ -17,4 +17,6 @@ To stop the app,
 
 ```
 docker-compose down
-```
\ No newline at end of file
+```
+
+or ctrl+c once to gracefully exit, twice to ungracefully exit. 
\ No newline at end of file
diff --git a/app.py b/app.py
index ac687ad..2d6aae8 100644
--- a/app.py
+++ b/app.py
@@ -17,9 +17,13 @@ import os
 
 # secrets
 def manage_sensitive(name):
+    v1 = os.getenv(name)
     secret_fpath = f'/run/secrets/{name}'
     existence = os.path.exists(secret_fpath)
     
+    if v1 is not None:
+        return v1
+    
     if existence:
         v2 = open(secret_fpath).read().rstrip('\n')
         return v2
diff --git a/deploy/Dockerfile b/deploy/Dockerfile
index 7a882fc..d5ef464 100644
--- a/deploy/Dockerfile
+++ b/deploy/Dockerfile
@@ -19,7 +19,7 @@ RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
 # Check if repo has been updated since last build
 ADD "https://gitlab.rc.uab.edu/anes_ai/mpog-helper-openai/commits?per_page=1" latest_commit
 RUN rm -rf latest_commit
-RUN git clone -b feature/azure2 https://gitlab.rc.uab.edu/anes_ai/mpog-helper-openai.git .
+RUN git clone https://gitlab.rc.uab.edu/anes_ai/mpog-helper-openai.git .
 
 #COPY .streamlit/secrets.toml /deploy/.streamlit/
 
-- 
GitLab