Commit 304c0a8f authored by Christophe Benz's avatar Christophe Benz

Raise error in config loading if required env var is not found

parent 3c01a449
......@@ -26,7 +26,7 @@ SECRET_KEY = os.environ.get("SECRET_KEY") or None
API_VALIDATE_ENDPOINT = os.environ.get("API_VALIDATE_ENDPOINT") or None
if API_VALIDATE_ENDPOINT is None:
log.error("API_VALIDATE_ENDPOINT environment variable is not set, validation is not possible")
raise ValueError("API_VALIDATE_ENDPOINT environment variable required")
SHIELDS_IO_BASE_URL = os.environ.get("SHIELDS_IO_BASE_URL") or None
if SHIELDS_IO_BASE_URL and not SHIELDS_IO_BASE_URL.endswith('/'):
......
......@@ -314,10 +314,6 @@ def get_badge_url_and_message(badge):
def validate(schema_instance: SchemaInstance, source: ValidataResource):
""" Validate source and display report """
# Validation is done through http call to validata-api
if config.API_VALIDATE_ENDPOINT is None:
flash_error("No Validate endpoint defined :-(")
return redirect(url_for("custom_validator"))
api_url = config.API_VALIDATE_ENDPOINT
# Useful to receive response as JSON
......@@ -519,11 +515,6 @@ def compute_validation_form_url(schema_instance: SchemaInstance):
def custom_validator():
"""Validator form"""
# Check that validata-api URL is set
if config.API_VALIDATE_ENDPOINT is None:
flash_error("URL de connexion à l'API non indiquée :-(")
return redirect(url_for('home'))
if request.method == 'GET':
# input is a hidden form parameter to know
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment