Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for .env File Configuration #107

Merged
merged 3 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
OPENAI_API_KEY=sk-...
SLACK_BOT_TOKEN=xoxb-...
SLACK_APP_TOKEN=xapp-1-...
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,19 @@ pip install -r requirements.txt
python main.py
```

### Using a .env File for Environment Variables (Optional)
Instead of exporting environment variables manually, you can use a .env file to simplify the setup:
seratch marked this conversation as resolved.
Show resolved Hide resolved

```bash
cp .env.example .env
```
Open the .env file and replace the placeholder values with your actual keys:
seratch marked this conversation as resolved.
Show resolved Hide resolved
```text
OPENAI_API_KEY=sk-your-openai-key
SLACK_BOT_TOKEN=xoxb-your-slack-bot-token
SLACK_APP_TOKEN=xapp-1-your-slack-app-token
```

## Running the App for Company Workspaces

Confidentiality of information is top priority for businesses.
Expand Down
2 changes: 2 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from dotenv import load_dotenv
import logging
import os

Expand All @@ -21,6 +22,7 @@
)
from app.slack_ui import build_home_tab

load_dotenv()

if __name__ == "__main__":
from slack_bolt.adapter.socket_mode import SocketModeHandler
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ tiktoken>=0.7,<0.8
# https://github.com/Yelp/elastalert/issues/2306
urllib3<2
pillow>=10.4.0,<11
requests>=2.32,<3
requests>=2.32,<3
python-dotenv==1.0.1
seratch marked this conversation as resolved.
Show resolved Hide resolved