Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Validata
validata-ui
Commits
304c0a8f
Commit
304c0a8f
authored
Jun 20, 2019
by
Christophe Benz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Raise error in config loading if required env var is not found
parent
3c01a449
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
10 deletions
+1
-10
validata_ui/config.py
validata_ui/config.py
+1
-1
validata_ui/views.py
validata_ui/views.py
+0
-9
No files found.
validata_ui/config.py
View file @
304c0a8f
...
...
@@ -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
.
e
rror
(
"API_VALIDATE_ENDPOINT environment variable
is not set, validation is not possible
"
)
raise
ValueE
rror
(
"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
(
'/'
):
...
...
validata_ui/views.py
View file @
304c0a8f
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment