This commit is contained in:
pablodanswer 2024-10-19 16:47:27 -07:00
parent 09dd7b424c
commit cddcec4ea4
7 changed files with 5 additions and 20 deletions

View File

@ -140,7 +140,7 @@ POSTGRES_PASSWORD = urllib.parse.quote_plus(
os.environ.get("POSTGRES_PASSWORD") or "password"
)
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_API_SERVER_POOL_SIZE = int(

View File

@ -360,7 +360,6 @@ def get_session_with_tenant(
finally:
# Reset search_path to default after the session is used
if MULTI_TENANT:
print("zzzzzz resetting search path")
cursor = dbapi_connection.cursor()
try:
cursor.execute('SET search_path TO "$user", public')

View File

@ -669,45 +669,34 @@ def create_connector_with_mock_credential(
user: User = Depends(current_curator_or_admin_user),
db_session: Session = Depends(get_session),
) -> StatusResponse:
print("Starting create_connector_with_mock_credential function")
if user and user.role != UserRole.ADMIN:
print(f"User role: {user.role}")
if connector_data.is_public:
print("Non-admin user attempting to create public credential")
raise HTTPException(
status_code=401,
detail="User does not have permission to create public credentials",
)
if not connector_data.groups:
print("Curator attempting to create connector without specifying groups")
raise HTTPException(
status_code=401,
detail="Curators must specify 1+ groups",
)
try:
print(f"Validating connector: {connector_data.source}")
_validate_connector_allowed(connector_data.source)
print("Creating connector")
connector_response = create_connector(
db_session=db_session, connector_data=connector_data
)
print(f"Connector created with ID: {connector_response.id}")
print("Creating mock credential")
mock_credential = CredentialBase(
credential_json={}, admin_public=True, source=connector_data.source
)
credential = create_credential(
mock_credential, user=user, db_session=db_session
)
print(f"Mock credential created with ID: {credential.id}")
access_type = (
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(
db_session=db_session,
user=user,
@ -717,11 +706,9 @@ def create_connector_with_mock_credential(
cc_pair_name=connector_data.name,
groups=connector_data.groups,
)
print("Credential added to connector successfully")
return response
except ValueError as e:
print(f"ValueError occurred: {str(e)}")
raise HTTPException(status_code=400, detail=str(e))

View File

@ -139,8 +139,7 @@ def create_credential_from_model(
)
from danswer.db.models import Credential
all_credentials = db_session.query(Credential).all()
print(f"Total number of credentials: {len(all_credentials)}")
db_session.query(Credential).all()
credential = create_credential(credential_info, user, db_session)
return ObjectCreationIdResponse(

View File

@ -313,7 +313,7 @@ services:
- POSTGRES_USER=${POSTGRES_USER:-postgres}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password}
ports:
- "5433:5432"
- "5432:5432"
volumes:
- db_volume:/var/lib/postgresql/data

View File

@ -313,7 +313,7 @@ services:
- POSTGRES_USER=${POSTGRES_USER:-postgres}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password}
ports:
- "5433:5432"
- "5432:5432"
volumes:
- db_volume:/var/lib/postgresql/data

View File

@ -157,7 +157,7 @@ services:
- POSTGRES_USER=${POSTGRES_USER:-postgres}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password}
ports:
- "5433"
- "5432"
volumes:
- db_volume:/var/lib/postgresql/data