Skip to content

Commit

Permalink
Merge pull request #1328 from solliancenet/mg-python-config-fix
Browse files Browse the repository at this point in the history
Commenting out python config calls/checks for now
  • Loading branch information
ciprianjichici authored Aug 1, 2024
2 parents f693b86 + d9c74d3 commit 5ebfe58
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 24 deletions.
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

0 comments on commit 5ebfe58

Please sign in to comment.