Merge branch 'main' into sort-file
This commit is contained in:
@@ -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 # 过期时间
|
||||
```
|
||||
|
@@ -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
|
||||
```
|
||||
|
@@ -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"
|
||||
|
Reference in New Issue
Block a user