diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..f74a61b --- /dev/null +++ b/.env.example @@ -0,0 +1,3 @@ +OPENAI_API_KEY=sk-... +SLACK_BOT_TOKEN=xoxb-... +SLACK_APP_TOKEN=xapp-1-... diff --git a/README.md b/README.md index 14752c0..b7d07ca 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,20 @@ pip install -r requirements.txt python main.py ``` +### Using .env for credential loading + +If you prefer using .env file to load env variables for local development, you can rename .env.example file to .env: + +```bash +cp .env.example .env +``` +Then, replace the values in .env file with your own API keys and tokens: +```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. diff --git a/main.py b/main.py index 5d9fdcd..ade0af8 100644 --- a/main.py +++ b/main.py @@ -1,3 +1,4 @@ +from dotenv import load_dotenv import logging import os @@ -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 diff --git a/requirements.txt b/requirements.txt index 9ace3fa..fa629b3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 \ No newline at end of file +requests>=2.32,<3 +python-dotenv>=1.0.1,<2 \ No newline at end of file