Merge pull request #1201 from danielaskdd/main

fix: auth_mode error in health check end point
This commit is contained in:
Daniel.y
2025-03-27 13:26:59 +08:00
committed by GitHub
3 changed files with 6 additions and 7 deletions

View File

@@ -201,8 +201,7 @@ LightRAG API 服务器使用基于 HS256 算法的 JWT 认证。要启用安全
```bash
# JWT 认证
AUTH_USERNAME=admin # 登录
AUTH_PASSWORD=admin123 # 密码
AUTH_ACCOUNTS='admin:admin123,user1:pass456' # 登录帐号与密码
TOKEN_SECRET=your-key # JWT 密钥
TOKEN_EXPIRE_HOURS=4 # 过期时间
```

View File

@@ -203,8 +203,7 @@ LightRAG API Server implements JWT-based authentication using HS256 algorithm. T
```bash
# For jwt auth
AUTH_USERNAME=admin # login name
AUTH_PASSWORD=admin123 # password
AUTH_ACCOUNTS='admin:admin123,user1:pass456' # login name and password, separated by comma
TOKEN_SECRET=your-key # JWT key
TOKEN_EXPIRE_HOURS=4 # expire duration
```

View File

@@ -56,6 +56,9 @@ load_dotenv(".env")
config = configparser.ConfigParser()
config.read("config.ini")
# Global authentication configuration
auth_configured = bool(auth_handler.accounts)
def create_app(args):
# Setup logging
@@ -426,9 +429,7 @@ def create_app(args):
try:
pipeline_status = await get_namespace_data("pipeline_status")
username = os.getenv("AUTH_USERNAME")
password = os.getenv("AUTH_PASSWORD")
if not (username and password):
if not auth_configured:
auth_mode = "disabled"
else:
auth_mode = "enabled"