Skip to content
Snippets Groups Projects
Commit 9cd4160e authored by Neda Moeini's avatar Neda Moeini
Browse files

Add configuration file to the project

parent 25c14572
Branches
Tags
1 merge request!1Feature/get graph data from gap
"""Configuration file for the Mapping Provider."""
import json
import jsonschema
CONFIG_SCHEMA = {
'$schema': 'http://json-schema.org/draft-07/schema#',
'type': 'object',
'properties': {
'aai': {
'type': 'object',
'properties': {
'discovery_endpoint_url': {'type': 'string'},
'client_id': {'type': 'string'},
'secret': {'type': 'string'},
},
'required': ['client_id', 'secret', 'discovery_endpoint_url'],
'additionalProperties': False
},
'orchestrator': {
'type': 'object',
'properties': {
'url': {'type': 'string'},
},
'required': ['url'],
'additionalProperties': False
},
},
'required': ['aai', 'orchestrator'],
'additionalProperties': False
}
def load(f):
"""loads, validates and returns configuration parameters.
:param f: file-like object that produces the config file
:return:
"""
config = json.loads(f.read())
jsonschema.validate(config, CONFIG_SCHEMA)
return config
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment