Skip to content

Commit

Permalink
Added: assumption check for client-server alienation (#329)
Browse files Browse the repository at this point in the history
  • Loading branch information
signebedi committed Sep 1, 2024
1 parent 6034c72 commit f909109
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion libreforms_fastapi/utils/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,22 @@ def validate_mongodb_configuration(config):
if config.MONGODB_ENABLED and config.MONGODB_URI == '':
raise ConfigurationError("MongoDB URI cannot be an empty string ('MONGODB_URI') when MongoDB is enabled ('MONGODB_ENABLED' = True).")

def validate_api_configuration(config):
if config.API_ENABLED:
if not config.REMOTE_API_ADDR:
raise ConfigurationError("The 'REMOTE_API_ADDR' configuration must be set when 'API_ENABLED' is True. Please check your configuration.")
if not config.REMOTE_API_KEY:
raise ConfigurationError("The 'REMOTE_API_KEY' configuration must be set when 'API_ENABLED' is True. Please check your configuration.")

# Main function to check all configurations
def check_configuration_assumptions(config):
validations = [
validate_domain,
validate_email_verification,
validate_help_emails_set,
validate_help_smtp_enabled,
validate_mongodb_configuration,
validate_mongodb_configuration,
validate_api_configuration,
]

for validation in validations:
Expand Down

0 comments on commit f909109

Please sign in to comment.