From e45b4748775295ec7085efbd7a0b20a0cc24ccdd Mon Sep 17 00:00:00 2001 From: Aditya Panwar Date: Wed, 9 Oct 2024 00:17:59 +0530 Subject: [PATCH] Update environment variables and secret key handling --- README.md | 7 ++++--- app.py | 2 +- example.env | 4 ++++ 3 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 example.env diff --git a/README.md b/README.md index 4d7f9cb..00d24a5 100644 --- a/README.md +++ b/README.md @@ -86,9 +86,10 @@ Follow these steps to set up and run the application on your local machine. Set your API keys for Google Gemini and OpenAI GPT-4: ```bash - export GENAI_API_KEY='your_genai_api_key' - export OPENAI_API_KEY='your_openai_api_key' - export GROQ_API_KEY='your_groq_api_key' + export APP_SECRET_KEY='your_app_secret_key' + export OPENAI_API_KEY='your_openai_api_key' + export GROQ_API_KEY='your_groq_api_key' + export GOOGLE_API_KEY='your_google_api_key' ``` On Windows Command Prompt: diff --git a/app.py b/app.py index 7121f6f..010dd41 100644 --- a/app.py +++ b/app.py @@ -17,7 +17,7 @@ # Initialize the Flask application app = Flask(__name__) -app.secret_key = 'your_secret_key' # Replace with a secure secret key +app.secret_key = os.getenv('APP_SECRET_KEY', 'localgpt') # Replace with a secure secret key logger = get_logger(__name__) diff --git a/example.env b/example.env new file mode 100644 index 0000000..13a352b --- /dev/null +++ b/example.env @@ -0,0 +1,4 @@ +APP_SECRET_KEY='your_app_secret_key' +OPENAI_API_KEY='your_openai_api_key' +GROQ_API_KEY='your_groq_api_key' +GOOGLE_API_KEY='your_google_api_key' \ No newline at end of file