Beispiel #1
0
def config_db_url(resource):
    config = ConfigHelper(resource)
    url = 'postgresql+psycopg2://{user}:{pw}@{host}:{port}/{db}'.format(
        db=config.get_property_by_section('datasource', 'inova.db.datasource'),
        host=config.get_property_by_section('datasource', 'inova.db.host'),
        port=config.get_property_by_section('datasource', 'inova.db.port'),
        user=config.get_property_by_section('datasource', 'inova.db.username'),
        pw=config.get_property_by_section('datasource', 'inova.db.password'))
    return url
Beispiel #2
0
def check_auth(username, password):
    """This function is called to check if a username /
    password combination is valid.
    """
    global APP_RESOURCE
    config = ConfigHelper(APP_RESOURCE)
    auth_username = config.get_property_by_section('server', 'auth.username')
    auth_password = config.get_property_by_section('server', 'auth.password')
    return username == auth_username and password == auth_password
#!/usr/bin/env python3
#
#   This script will run the main application file in debug mode.
#
#   author: Michael Gruber
#
#   Adapted by Lucas Nadalete

from sys import path
import os.path
path.append('src/main/python/')

from helper.config_helper import ConfigHelper
from webapp import application, APP_RESOURCE

# Load server configuration
helper = ConfigHelper(APP_RESOURCE)
chost = helper.get_property_by_section('server', 'inova.host')
cport = int(helper.get_property_by_section('server', 'inova.port'))
cdebug = bool(helper.get_property_by_section('server', 'inova.debug'))

# Start Web Server for all hosts, ssl_context=('cert.pem', 'key.pem')

if __name__ == "__main__":
    application.run(host=chost, debug=cdebug, port=cport)