Skip to content
Permalink
Browse files

always chcek for dummy isso config to prevent memory leaks

  • Loading branch information...
JeffVandrewJr committed May 22, 2019
1 parent 18cda4c commit 33c0d37601f98a88ab03d7630f2208a4d4d3501e
Showing with 16 additions and 22 deletions.
  1. +12 −20 app/__init__.py
  2. +4 −2 config.py
@@ -20,7 +20,7 @@
'''


VERSION = '0.7.35'
VERSION = '0.7.37'

# register extensions
bootstrap = Bootstrap()
@@ -68,6 +68,17 @@ def create_app(config_class=Config):
app.config.from_object(config_class)
app.jinja_env.globals['THEME_FILE'] = 'themes/' + \
app.config['THEME'] + '.min.css'
file = app.config['ISSO_CONFIG_PATH']
if not os.path.isfile(file):
isso_config = ConfigParser()
isso_config['default'] = {}
isso_config['default']['dbpath'] = \
'var/lib/db/comments.db'
isso_config['default']['host'] = \
'http://localhost:5000/'
with open(file, 'w') as configfile:
isso_config.write(configfile)
app.logger.info('Isso dummy configuration success.')
bootstrap.init_app(app)
db.init_app(app)
with app.app_context():
@@ -141,25 +152,6 @@ def load_tasks():
app.logger.info(f'Next renewal time: \
{scheduler._scheduler.get_jobs()[0].next_run_time}')

@app.before_first_request
def load_isso():
from app.models import ThirdPartyServices
isso = ThirdPartyServices.query.filter_by(name='isso').first()
if isso is not None:
app.config['COMMENTS'] = True
else:
file = app.config['ISSO_CONFIG_PATH']
if not os.path.isfile(file):
isso_config = ConfigParser()
isso_config['default'] = {}
isso_config['default']['dbpath'] = \
'var/lib/db/comments.db'
isso_config['default']['host'] = \
'http://localhost:5000/'
with open(file, 'w') as configfile:
isso_config.write(configfile)
app.logger.info('Isso configuration success.')

return app


@@ -20,8 +20,10 @@ class Config(object):
BLOGGING_PLUGINS = None
BLOGGING_ALLOW_FILE_UPLOAD = True
BLOGGING_ESCAPE_MARKDOWN = False
ISSO_CONFIG_PATH = os.environ.get('ISSO_CONFIG_PATH') or '/var/lib/config/isso.cfg'
COMMENTS_DB_PATH = os.environ.get('COMMENTS_DB_PATH') or '/var/lib/db/comments.db'
ISSO_CONFIG_PATH = os.environ.get('ISSO_CONFIG_PATH') or \
'/var/lib/config/isso.cfg'
COMMENTS_DB_PATH = os.environ.get('COMMENTS_DB_PATH') or \
'/var/lib/db/comments.db'
COMMENTS = False
COMMENTS_SUBURI = os.environ.get('COMMENTS_SUBURI') is not None
if COMMENTS_SUBURI:

0 comments on commit 33c0d37

Please sign in to comment.
You can’t perform that action at this time.