mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-07-12 22:23:01 +02:00
k
This commit is contained in:
@ -140,7 +140,7 @@ POSTGRES_PASSWORD = urllib.parse.quote_plus(
|
|||||||
os.environ.get("POSTGRES_PASSWORD") or "password"
|
os.environ.get("POSTGRES_PASSWORD") or "password"
|
||||||
)
|
)
|
||||||
POSTGRES_HOST = os.environ.get("POSTGRES_HOST") or "localhost"
|
POSTGRES_HOST = os.environ.get("POSTGRES_HOST") or "localhost"
|
||||||
POSTGRES_PORT = os.environ.get("POSTGRES_PORT") or "5433"
|
POSTGRES_PORT = os.environ.get("POSTGRES_PORT") or "5432"
|
||||||
POSTGRES_DB = os.environ.get("POSTGRES_DB") or "postgres"
|
POSTGRES_DB = os.environ.get("POSTGRES_DB") or "postgres"
|
||||||
|
|
||||||
POSTGRES_API_SERVER_POOL_SIZE = int(
|
POSTGRES_API_SERVER_POOL_SIZE = int(
|
||||||
|
@ -360,7 +360,6 @@ def get_session_with_tenant(
|
|||||||
finally:
|
finally:
|
||||||
# Reset search_path to default after the session is used
|
# Reset search_path to default after the session is used
|
||||||
if MULTI_TENANT:
|
if MULTI_TENANT:
|
||||||
print("zzzzzz resetting search path")
|
|
||||||
cursor = dbapi_connection.cursor()
|
cursor = dbapi_connection.cursor()
|
||||||
try:
|
try:
|
||||||
cursor.execute('SET search_path TO "$user", public')
|
cursor.execute('SET search_path TO "$user", public')
|
||||||
|
@ -669,45 +669,34 @@ def create_connector_with_mock_credential(
|
|||||||
user: User = Depends(current_curator_or_admin_user),
|
user: User = Depends(current_curator_or_admin_user),
|
||||||
db_session: Session = Depends(get_session),
|
db_session: Session = Depends(get_session),
|
||||||
) -> StatusResponse:
|
) -> StatusResponse:
|
||||||
print("Starting create_connector_with_mock_credential function")
|
|
||||||
if user and user.role != UserRole.ADMIN:
|
if user and user.role != UserRole.ADMIN:
|
||||||
print(f"User role: {user.role}")
|
|
||||||
if connector_data.is_public:
|
if connector_data.is_public:
|
||||||
print("Non-admin user attempting to create public credential")
|
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=401,
|
status_code=401,
|
||||||
detail="User does not have permission to create public credentials",
|
detail="User does not have permission to create public credentials",
|
||||||
)
|
)
|
||||||
if not connector_data.groups:
|
if not connector_data.groups:
|
||||||
print("Curator attempting to create connector without specifying groups")
|
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=401,
|
status_code=401,
|
||||||
detail="Curators must specify 1+ groups",
|
detail="Curators must specify 1+ groups",
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
print(f"Validating connector: {connector_data.source}")
|
|
||||||
_validate_connector_allowed(connector_data.source)
|
_validate_connector_allowed(connector_data.source)
|
||||||
print("Creating connector")
|
|
||||||
connector_response = create_connector(
|
connector_response = create_connector(
|
||||||
db_session=db_session, connector_data=connector_data
|
db_session=db_session, connector_data=connector_data
|
||||||
)
|
)
|
||||||
print(f"Connector created with ID: {connector_response.id}")
|
|
||||||
|
|
||||||
print("Creating mock credential")
|
|
||||||
mock_credential = CredentialBase(
|
mock_credential = CredentialBase(
|
||||||
credential_json={}, admin_public=True, source=connector_data.source
|
credential_json={}, admin_public=True, source=connector_data.source
|
||||||
)
|
)
|
||||||
credential = create_credential(
|
credential = create_credential(
|
||||||
mock_credential, user=user, db_session=db_session
|
mock_credential, user=user, db_session=db_session
|
||||||
)
|
)
|
||||||
print(f"Mock credential created with ID: {credential.id}")
|
|
||||||
|
|
||||||
access_type = (
|
access_type = (
|
||||||
AccessType.PUBLIC if connector_data.is_public else AccessType.PRIVATE
|
AccessType.PUBLIC if connector_data.is_public else AccessType.PRIVATE
|
||||||
)
|
)
|
||||||
print(f"Access type: {access_type}")
|
|
||||||
|
|
||||||
print("Adding credential to connector")
|
|
||||||
response = add_credential_to_connector(
|
response = add_credential_to_connector(
|
||||||
db_session=db_session,
|
db_session=db_session,
|
||||||
user=user,
|
user=user,
|
||||||
@ -717,11 +706,9 @@ def create_connector_with_mock_credential(
|
|||||||
cc_pair_name=connector_data.name,
|
cc_pair_name=connector_data.name,
|
||||||
groups=connector_data.groups,
|
groups=connector_data.groups,
|
||||||
)
|
)
|
||||||
print("Credential added to connector successfully")
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
print(f"ValueError occurred: {str(e)}")
|
|
||||||
raise HTTPException(status_code=400, detail=str(e))
|
raise HTTPException(status_code=400, detail=str(e))
|
||||||
|
|
||||||
|
|
||||||
|
@ -139,8 +139,7 @@ def create_credential_from_model(
|
|||||||
)
|
)
|
||||||
from danswer.db.models import Credential
|
from danswer.db.models import Credential
|
||||||
|
|
||||||
all_credentials = db_session.query(Credential).all()
|
db_session.query(Credential).all()
|
||||||
print(f"Total number of credentials: {len(all_credentials)}")
|
|
||||||
|
|
||||||
credential = create_credential(credential_info, user, db_session)
|
credential = create_credential(credential_info, user, db_session)
|
||||||
return ObjectCreationIdResponse(
|
return ObjectCreationIdResponse(
|
||||||
|
@ -313,7 +313,7 @@ services:
|
|||||||
- POSTGRES_USER=${POSTGRES_USER:-postgres}
|
- POSTGRES_USER=${POSTGRES_USER:-postgres}
|
||||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password}
|
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password}
|
||||||
ports:
|
ports:
|
||||||
- "5433:5432"
|
- "5432:5432"
|
||||||
volumes:
|
volumes:
|
||||||
- db_volume:/var/lib/postgresql/data
|
- db_volume:/var/lib/postgresql/data
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ services:
|
|||||||
- POSTGRES_USER=${POSTGRES_USER:-postgres}
|
- POSTGRES_USER=${POSTGRES_USER:-postgres}
|
||||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password}
|
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password}
|
||||||
ports:
|
ports:
|
||||||
- "5433:5432"
|
- "5432:5432"
|
||||||
volumes:
|
volumes:
|
||||||
- db_volume:/var/lib/postgresql/data
|
- db_volume:/var/lib/postgresql/data
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ services:
|
|||||||
- POSTGRES_USER=${POSTGRES_USER:-postgres}
|
- POSTGRES_USER=${POSTGRES_USER:-postgres}
|
||||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password}
|
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password}
|
||||||
ports:
|
ports:
|
||||||
- "5433"
|
- "5432"
|
||||||
volumes:
|
volumes:
|
||||||
- db_volume:/var/lib/postgresql/data
|
- db_volume:/var/lib/postgresql/data
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user