Changeset - 98e470f2ae16
[Not reviewed]
dev
0 2 0
Dennis Fink - 9 years ago 2016-05-16 21:13:07
dennis.fink@c3l.lu
Make onionoo configurable
2 files changed with 3 insertions and 0 deletions:
0 comments (0 inline, 0 general)
ennstatus/api/views.py
Show inline comments
 
@@ -106,24 +106,25 @@ def update():
 

	
 
    data['country'] = country
 
    data['last_updated'] = strict_rfc3339.timestamp_to_rfc3339_utcoffset(
 
        datetime.utcnow().timestamp()
 
    )
 

	
 
    try:
 
        server = Server.from_dict(data)
 
    except Exception as e:
 
        current_app.logger.warning(' '.join([str(e), str(data)]))
 
        return str(e), 409, {'Content-Type': 'text/plain'}
 

	
 
    if current_app.config['ENNSTATUS_ENABLE_ONIONOO']:
 
    try:
 
        server.update_weights()
 
    except NotImplementedError:
 
        pass
 

	
 
    try:
 
        server.update_flags()
 
    except NotImplementedError:
 
        pass
 

	
 
    try:
 
        server.save()
ennstatus/config.py
Show inline comments
 
@@ -27,12 +27,14 @@ def init_app(app):
 
    config['SECRET_KEY'] = os.environ.get('SECRET_KEY', _default_secret_key)
 

	
 
    # Flask-Bootstrap
 
    config.setdefault('BOOTSTRAP_SERVE_LOCAL', True)
 

	
 
    # ennstatus
 

	
 
    # moment.js string formatting
 
    # http://momentjs.com/docs/#/displaying/format/
 
    config.setdefault('ENNSTATUS_MOMENTJS_FORMAT', 'DD MMMM YYYY HH:mm:ss')
 

	
 
    config.setdefault('ENNSTATUS_STRFTIME_FORMAT', '%d %B %Y %H:%M:%S')
 

	
 
    config.setdefault('ENNSTATUS_ENABLE_ONIONOO', False)
0 comments (0 inline, 0 general)