Include resend as a default dependency, rather than restricting to prod

This commit is contained in:
sabaimran 2024-12-16 22:24:41 -08:00
parent 741e9f56f9
commit 3b050a33bb
3 changed files with 20 additions and 24 deletions

View file

@ -11,23 +11,6 @@ By default, most of the instructions for self-hosting Khoj assume a single user,
Remove the `--anonymous-mode` flag from your khoj start up command or docker-compose file to enable authentication.
:::
For either of these methods, you'll need to use the prod version of the Khoj package. You can install it as below:
<Tabs groupId="server" queryString>
<TabItem value="docker" label="Docker">
Update your `docker-compose.yml` to use the prod image
```bash
image: ghcr.io/khoj-ai/khoj-cloud:latest
```
</TabItem>
<TabItem value="pip" label="Pip">
```bash
pip install khoj[prod]
```
</TabItem>
</Tabs>
## Using Magic Links
The most secure way to do this is to integrate with [Resend](https://resend.com).
@ -62,6 +45,23 @@ It's still possible to use the magic links feature without Resend, but you'll ne
## Using Google OAuth
For this method, you'll need to use the prod version of the Khoj package. You can install it as below:
<Tabs groupId="server" queryString>
<TabItem value="docker" label="Docker">
Update your `docker-compose.yml` to use the prod image
```bash
image: ghcr.io/khoj-ai/khoj-cloud:latest
```
</TabItem>
<TabItem value="pip" label="Pip">
```bash
pip install khoj[prod]
```
</TabItem>
</Tabs>
To set up your self-hosted Khoj with Google Auth, you need to create a project in the Google Cloud Console and enable the Google Auth API.
To implement this, you'll need to:

View file

@ -90,6 +90,7 @@ dependencies = [
"docx2txt == 0.8",
"google-generativeai == 0.8.3",
"pyjson5 == 1.6.7",
"resend == 1.0.1",
]
dynamic = ["version"]
@ -108,7 +109,6 @@ prod = [
"stripe == 7.3.0",
"twilio == 8.11",
"boto3 >= 1.34.57",
"resend == 1.0.1",
]
dev = [
"khoj[prod]",

View file

@ -1,12 +1,8 @@
import logging
import os
try:
import resend
except ImportError:
pass
import markdown_it
import resend
from django.conf import settings
from jinja2 import Environment, FileSystemLoader
@ -23,7 +19,7 @@ static_files = os.path.join(settings.BASE_DIR, "static")
env = Environment(loader=FileSystemLoader(static_files))
if not RESEND_API_KEY:
logger.warn("RESEND_API_KEY not set - email sending disabled")
logger.warning("RESEND_API_KEY not set - email sending disabled")
else:
resend.api_key = RESEND_API_KEY