Merge branch 'main' into sort-file
This commit is contained in:
@@ -201,8 +201,7 @@ LightRAG API 服务器使用基于 HS256 算法的 JWT 认证。要启用安全
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# JWT 认证
|
# JWT 认证
|
||||||
AUTH_USERNAME=admin # 登录名
|
AUTH_ACCOUNTS='admin:admin123,user1:pass456' # 登录帐号与密码
|
||||||
AUTH_PASSWORD=admin123 # 密码
|
|
||||||
TOKEN_SECRET=your-key # JWT 密钥
|
TOKEN_SECRET=your-key # JWT 密钥
|
||||||
TOKEN_EXPIRE_HOURS=4 # 过期时间
|
TOKEN_EXPIRE_HOURS=4 # 过期时间
|
||||||
```
|
```
|
||||||
|
@@ -203,8 +203,7 @@ LightRAG API Server implements JWT-based authentication using HS256 algorithm. T
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# For jwt auth
|
# For jwt auth
|
||||||
AUTH_USERNAME=admin # login name
|
AUTH_ACCOUNTS='admin:admin123,user1:pass456' # login name and password, separated by comma
|
||||||
AUTH_PASSWORD=admin123 # password
|
|
||||||
TOKEN_SECRET=your-key # JWT key
|
TOKEN_SECRET=your-key # JWT key
|
||||||
TOKEN_EXPIRE_HOURS=4 # expire duration
|
TOKEN_EXPIRE_HOURS=4 # expire duration
|
||||||
```
|
```
|
||||||
|
@@ -56,6 +56,9 @@ load_dotenv(".env")
|
|||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read("config.ini")
|
config.read("config.ini")
|
||||||
|
|
||||||
|
# Global authentication configuration
|
||||||
|
auth_configured = bool(auth_handler.accounts)
|
||||||
|
|
||||||
|
|
||||||
def create_app(args):
|
def create_app(args):
|
||||||
# Setup logging
|
# Setup logging
|
||||||
@@ -426,9 +429,7 @@ def create_app(args):
|
|||||||
try:
|
try:
|
||||||
pipeline_status = await get_namespace_data("pipeline_status")
|
pipeline_status = await get_namespace_data("pipeline_status")
|
||||||
|
|
||||||
username = os.getenv("AUTH_USERNAME")
|
if not auth_configured:
|
||||||
password = os.getenv("AUTH_PASSWORD")
|
|
||||||
if not (username and password):
|
|
||||||
auth_mode = "disabled"
|
auth_mode = "disabled"
|
||||||
else:
|
else:
|
||||||
auth_mode = "enabled"
|
auth_mode = "enabled"
|
||||||
|
Reference in New Issue
Block a user