Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions backend/apps/system/crud/assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def init_dynamic_cors(app: FastAPI):
response_middleware = middleware
if cors_middleware and response_middleware:
break

updated_origins = list(set(settings.all_cors_origins + unique_domains))
if cors_middleware:
cors_middleware.kwargs['allow_origins'] = updated_origins
Expand Down Expand Up @@ -238,19 +238,19 @@ def get_ds(self, ds_id: int, trans: Trans = None):

def convert2schema(self, ds_dict: dict, config: dict[any]) -> AssistantOutDsSchema:
id_marker: str = ''
attr_list = ['name', 'type', 'host', 'port', 'user', 'dataBase', 'schema', 'mode']
attr_list = ['name', 'type', 'host', 'port', 'user', 'dataBase', 'schema', 'mode', 'lowVersion']
if config.get('encrypt', False):
key = config.get('aes_key', None)
iv = config.get('aes_iv', None)
aes_attrs = ['host', 'user', 'password', 'dataBase', 'db_schema', 'schema', 'mode']
aes_attrs = ['host', 'user', 'password', 'dataBase', 'db_schema', 'schema', 'mode', 'lowVersion']
for attr in aes_attrs:
if attr in ds_dict and ds_dict[attr]:
try:
ds_dict[attr] = simple_aes_decrypt(ds_dict[attr], key, iv)
except Exception as e:
raise Exception(
f"Failed to encrypt {attr} for datasource {ds_dict.get('name')}, error: {str(e)}")

id = ds_dict.get('id', None)
if not id:
for attr in attr_list:
Expand Down Expand Up @@ -279,7 +279,8 @@ def get_out_ds_conf(ds: AssistantOutDsSchema, timeout: int = 30) -> str:
"extraJdbc": ds.extraParams or '',
"dbSchema": ds.db_schema or '',
"timeout": timeout or 30,
"mode": ds.mode or ''
"mode": ds.mode or '',
"lowVersion": ds.lowVersion or False,
}
conf["extraJdbc"] = ''
return aes_encrypt(json.dumps(conf))
1 change: 1 addition & 0 deletions backend/apps/system/schemas/system_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ class AssistantOutDsSchema(AssistantOutDsBase):
db_schema: Optional[str] = None
extraParams: Optional[str] = None
mode: Optional[str] = None
lowVersion: Optional[bool] = False
tables: Optional[list[AssistantTableSchema]] = None


Expand Down
Loading