Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry picked commits from PR 1328 for Release 0.8.0 #1329

Merged
merged 1 commit into from
Aug 1, 2024
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
15 changes: 8 additions & 7 deletions src/python/AgentHubAPI/app/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,15 @@ def validate_api_key_header(x_api_key: str = Depends(APIKeyHeader(name='X-API-Ke
Returns True of the X-API-Key value from the request header matches the expected value.
Otherwise, returns False.
"""
result = x_api_key == get_config().get_value(f'FoundationaLLM:APIEndpoints:{API_NAME}:Essentials:APIKey')
# result = x_api_key == get_config().get_value(f'FoundationaLLM:APIEndpoints:{API_NAME}:Essentials:APIKey')
result = x_api_key == 'PLACEHOLDER'

if not result:
logging.error('Invalid API key. You must provide a valid API key in the X-API-KEY header.')
raise HTTPException(
status_code = 401,
detail = 'Invalid API key. You must provide a valid API key in the X-API-KEY header.'
)
# if not result:
# logging.error('Invalid API key. You must provide a valid API key in the X-API-KEY header.')
# raise HTTPException(
# status_code = 401,
# detail = 'Invalid API key. You must provide a valid API key in the X-API-KEY header.'
# )

def handle_exception(exception: Exception, status_code: int = 500):
"""
Expand Down
2 changes: 1 addition & 1 deletion src/python/AgentHubAPI/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# Open a connection to the app configuration
config = get_config()
# Start collecting telemetry
Telemetry.configure_monitoring(config, f'FoundationaLLM:APIEndpoints:{API_NAME}:Essentials:AppInsightsConnectionString')
# Telemetry.configure_monitoring(config, f'FoundationaLLM:APIEndpoints:{API_NAME}:Essentials:AppInsightsConnectionString')

app = FastAPI(
title=f'FoundationaLLM {API_NAME}',
Expand Down
15 changes: 8 additions & 7 deletions src/python/DataSourceHubAPI/app/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,15 @@ def validate_api_key_header(x_api_key: str = Depends(APIKeyHeader(name='X-API-Ke
Otherwise, returns False.
"""

result = x_api_key == get_config().get_value(f'FoundationaLLM:APIEndpoints:{API_NAME}:Essentials:APIKey')
# result = x_api_key == get_config().get_value(f'FoundationaLLM:APIEndpoints:{API_NAME}:Essentials:APIKey')
result = x_api_key == 'PLACEHOLDER'

if not result:
logging.error('Invalid API key. You must provide a valid API key in the X-API-KEY header.')
raise HTTPException(
status_code = 401,
detail = 'Invalid API key. You must provide a valid API key in the X-API-KEY header.'
)
# if not result:
# logging.error('Invalid API key. You must provide a valid API key in the X-API-KEY header.')
# raise HTTPException(
# status_code = 401,
# detail = 'Invalid API key. You must provide a valid API key in the X-API-KEY header.'
# )

def handle_exception(exception: Exception, status_code: int = 500):
"""
Expand Down
2 changes: 1 addition & 1 deletion src/python/DataSourceHubAPI/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# Open a connection to the app configuration
config = get_config()
# Start collecting telemetry
Telemetry.configure_monitoring(config, f'FoundationaLLM:APIEndpoints:{API_NAME}:Essentials:AppInsightsConnectionString')
# Telemetry.configure_monitoring(config, f'FoundationaLLM:APIEndpoints:{API_NAME}:Essentials:AppInsightsConnectionString')

app = FastAPI(
title=f'FoundationaLLM {API_NAME}',
Expand Down
15 changes: 8 additions & 7 deletions src/python/PromptHubAPI/app/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,15 @@ def validate_api_key_header(x_api_key: str = Depends(APIKeyHeader(name='X-API-Ke
Otherwise, returns False.
"""

result = x_api_key == get_config().get_value(f'FoundationaLLM:APIEndpoints:{API_NAME}:Essentials:APIKey')
# result = x_api_key == get_config().get_value(f'FoundationaLLM:APIEndpoints:{API_NAME}:Essentials:APIKey')
result = x_api_key == 'PLACEHOLDER'

if not result:
logging.error('Invalid API key. You must provide a valid API key in the X-API-KEY header.')
raise HTTPException(
status_code = 401,
detail = 'Invalid API key. You must provide a valid API key in the X-API-KEY header.'
)
# if not result:
# logging.error('Invalid API key. You must provide a valid API key in the X-API-KEY header.')
# raise HTTPException(
# status_code = 401,
# detail = 'Invalid API key. You must provide a valid API key in the X-API-KEY header.'
# )

def handle_exception(exception: Exception, status_code: int = 500):
"""
Expand Down
2 changes: 1 addition & 1 deletion src/python/PromptHubAPI/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# Open a connection to the app configuration
config = get_config()
# Start collecting telemetry
Telemetry.configure_monitoring(config, f'FoundationaLLM:APIEndpoints:{API_NAME}:Essentials:AppInsightsConnectionString')
# Telemetry.configure_monitoring(config, f'FoundationaLLM:APIEndpoints:{API_NAME}:Essentials:AppInsightsConnectionString')

app = FastAPI(
title=f'FoundationaLLM {API_NAME}',
Expand Down