Compare commits
2 Commits
98c77bf719
...
941261c830
Author | SHA1 | Date |
---|---|---|
Emmanuel Garette | 941261c830 | |
Emmanuel Garette | 6c4bbb3dca |
|
@ -1,6 +1,7 @@
|
||||||
from os import environ
|
from os import environ
|
||||||
from os.path import isfile
|
from os.path import isfile
|
||||||
from configobj import ConfigObj
|
from configobj import ConfigObj
|
||||||
|
from uuid import uuid4
|
||||||
|
|
||||||
|
|
||||||
CONFIG_FILE = environ.get('CONFIG_FILE', '/etc/risotto/risotto.conf')
|
CONFIG_FILE = environ.get('CONFIG_FILE', '/etc/risotto/risotto.conf')
|
||||||
|
@ -88,6 +89,28 @@ if 'IMAGE_PATH' in environ:
|
||||||
IMAGE_PATH = environ['IMAGE_PATH']
|
IMAGE_PATH = environ['IMAGE_PATH']
|
||||||
else:
|
else:
|
||||||
IMAGE_PATH = config.get('IMAGE_PATH', '/tmp')
|
IMAGE_PATH = config.get('IMAGE_PATH', '/tmp')
|
||||||
|
if 'PASSWORD_ADMIN_USERNAME' in environ:
|
||||||
|
PASSWORD_ADMIN_USERNAME = environ['PASSWORD_ADMIN_USERNAME']
|
||||||
|
else:
|
||||||
|
PASSWORD_ADMIN_USERNAME = config.get('PASSWORD_ADMIN_USERNAME', 'risotto')
|
||||||
|
if 'PASSWORD_ADMIN_EMAIL' in environ:
|
||||||
|
PASSWORD_ADMIN_EMAIL = environ['PASSWORD_ADMIN_EMAIL']
|
||||||
|
else:
|
||||||
|
# this parameter is mandatory
|
||||||
|
PASSWORD_ADMIN_EMAIL = config['PASSWORD_ADMIN_EMAIL']
|
||||||
|
if 'PASSWORD_ADMIN_PASSWORD' in environ:
|
||||||
|
PASSWORD_ADMIN_PASSWORD = environ['PASSWORD_ADMIN_PASSWORD']
|
||||||
|
else:
|
||||||
|
# this parameter is mandatory
|
||||||
|
PASSWORD_ADMIN_PASSWORD = config['PASSWORD_ADMIN_PASSWORD']
|
||||||
|
if 'PASSWORD_DEVICE_IDENTIFIER' in environ:
|
||||||
|
PASSWORD_DEVICE_IDENTIFIER = environ['PASSWORD_DEVICE_IDENTIFIER']
|
||||||
|
else:
|
||||||
|
PASSWORD_DEVICE_IDENTIFIER = config.get('PASSWORD_DEVICE_IDENTIFIER', uuid4())
|
||||||
|
if 'PASSWORD_URL' in environ:
|
||||||
|
PASSWORD_URL = environ['PASSWORD_URL']
|
||||||
|
else:
|
||||||
|
PASSWORD_URL = config.get('PASSWORD_URL', 'https://localhost:8001/')
|
||||||
|
|
||||||
|
|
||||||
def dsn_factory(database, user, password, address=DB_ADDRESS):
|
def dsn_factory(database, user, password, address=DB_ADDRESS):
|
||||||
|
@ -110,6 +133,12 @@ _config = {'database': {'dsn': dsn_factory(RISOTTO_DB_NAME, RISOTTO_DB_USER, RIS
|
||||||
'sql_dir': SQL_DIR,
|
'sql_dir': SQL_DIR,
|
||||||
'tmp_dir': TMP_DIR,
|
'tmp_dir': TMP_DIR,
|
||||||
},
|
},
|
||||||
|
'password': {'admin_username': PASSWORD_ADMIN_USERNAME,
|
||||||
|
'admin_email': PASSWORD_ADMIN_EMAIL,
|
||||||
|
'admin_password': PASSWORD_ADMIN_PASSWORD,
|
||||||
|
'device_identifier': PASSWORD_DEVICE_IDENTIFIER,
|
||||||
|
'service_url': PASSWORD_URL,
|
||||||
|
},
|
||||||
'cache': {'root_path': CACHE_ROOT_PATH},
|
'cache': {'root_path': CACHE_ROOT_PATH},
|
||||||
'servermodel': {'internal_source_path': SRV_SEED_PATH,
|
'servermodel': {'internal_source_path': SRV_SEED_PATH,
|
||||||
'internal_source': 'internal'},
|
'internal_source': 'internal'},
|
||||||
|
|
|
@ -349,7 +349,7 @@ class Dispatcher(register.RegisterDispatcher,
|
||||||
sql = '''
|
sql = '''
|
||||||
SELECT UserId
|
SELECT UserId
|
||||||
FROM UserUser
|
FROM UserUser
|
||||||
WHERE UserLogin = $1
|
WHERE Login = $1
|
||||||
'''
|
'''
|
||||||
user_id = await connection.fetchval(sql,
|
user_id = await connection.fetchval(sql,
|
||||||
user_login)
|
user_login)
|
||||||
|
|
Loading…
Reference in New Issue