diff --git a/documentation/docs/advanced/authentication.mdx b/documentation/docs/advanced/authentication.mdx index 2df7ac5b..34523d14 100644 --- a/documentation/docs/advanced/authentication.mdx +++ b/documentation/docs/advanced/authentication.mdx @@ -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: - - - - Update your `docker-compose.yml` to use the prod image - ```bash - image: ghcr.io/khoj-ai/khoj-cloud:latest - ``` - - - - ```bash - pip install khoj[prod] - ``` - - - ## 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: + + + + Update your `docker-compose.yml` to use the prod image + ```bash + image: ghcr.io/khoj-ai/khoj-cloud:latest + ``` + + + + ```bash + pip install khoj[prod] + ``` + + + 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: diff --git a/pyproject.toml b/pyproject.toml index fbe4135e..3932bdbb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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]", diff --git a/src/khoj/routers/email.py b/src/khoj/routers/email.py index 83ce5cd5..1a1c5684 100644 --- a/src/khoj/routers/email.py +++ b/src/khoj/routers/email.py @@ -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