Skip to content

Commit

Permalink
adding debug
Browse files Browse the repository at this point in the history
  • Loading branch information
proycon committed Apr 30, 2018
1 parent d03b17c commit 229f56a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion clam/clamdispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import signal
import shutil

VERSION = '2.3'
VERSION = '2.3.1'

sys.path.append(sys.path[0] + '/..')

Expand Down
15 changes: 14 additions & 1 deletion clam/clamservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -2440,13 +2440,17 @@ def __init__(self, mode = 'debug'):
warning("*** NO AUTHENTICATION ENABLED!!! This is strongly discouraged in production environments! ***")
self.auth = clam.common.auth.NoAuth() #pylint: disable=redefined-variable-type

printdebug("Full settings dump: " + repr(vars(settings)))


printdebug("Initialising flask service")
self.service = flask.Flask("clam")
self.service.jinja_env.trim_blocks = True
self.service.jinja_env.lstrip_blocks = True
self.service.secret_key = settings.SECRET_KEY
printdebug("Registering main entrypoint: " + settings.STANDALONEURLPREFIX + "/")
self.service.add_url_rule(settings.STANDALONEURLPREFIX + '/', 'index', self.auth.require_login(index), methods=['GET'] )
printdebug("Registering info entrypoint: " + settings.STANDALONEURLPREFIX + "/info/")
self.service.add_url_rule(settings.STANDALONEURLPREFIX + '/info/', 'info', info, methods=['GET'] )
self.service.add_url_rule(settings.STANDALONEURLPREFIX + '/login/', 'login', Login.GET, methods=['GET'] )
self.service.add_url_rule(settings.STANDALONEURLPREFIX + '/logout/', 'logout', self.auth.require_login(Logout.GET), methods=['GET'] )
Expand Down Expand Up @@ -2502,14 +2506,23 @@ def __init__(self, mode = 'debug'):
self.mode = mode
if self.mode != 'wsgi' and (settings.OAUTH or settings.PREAUTHHEADER or settings.BASICAUTH):
warning("*** YOU ARE RUNNING THE DEVELOPMENT SERVER, THIS IS INSECURE WITH THE CONFIGURED AUTHENTICATION METHOD ***")
printlog("Server available on http://" + settings.HOST + ":" + str(settings.PORT) +'/' + settings.URLPREFIX)
if settings.PORT == 443:
printlog("Server available on https://" + settings.HOST + '/' + settings.URLPREFIX)
elif settings.PORT == 80:
printlog("Server available on http://" + settings.HOST + '/' + settings.URLPREFIX)
else:
printlog("Server available on http://" + settings.HOST + ":" + str(settings.PORT) +'/' + settings.URLPREFIX)
if settings.FORCEURL:
printlog("Access using forced URL: " + settings.FORCEURL)

if self.mode == 'wsgi':
printdebug("DEBUG="+str(DEBUG))
printdebug("CLAM started in wsgi mode")
self.service.debug = DEBUG
elif self.mode in ('standalone','debug'):
self.service.debug = (mode == 'debug')
printdebug("DEBUG="+str(mode=='debug'))
printdebug("CLAM started in " + self.mode + " mode")
self.service.run(host='0.0.0.0',port=settings.PORT)
else:
raise Exception("Unknown mode: " + mode + ", specify 'wsgi', 'standalone' or 'debug'")
Expand Down
2 changes: 1 addition & 1 deletion clam/common/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import clam.common.util
import clam.common.viewers

VERSION = '2.3'
VERSION = '2.3.1'

#dirs for services shipped with CLAM itself
CONFIGDIR = os.path.abspath(os.path.dirname(__file__) + '/../config/')
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def read(fname):

setup(
name = "CLAM",
version = "2.3", #also change in clam.common.data.VERSION
version = "2.3.1", #also change in clam.common.data.VERSION and dispatcher.py
author = "Maarten van Gompel",
author_email = "proycon@anaproy.nl",
description = ("Turns command-line NLP tools into fully-fledged RESTful webservices with an auto-generated web-interface for human end-users."),
Expand Down

0 comments on commit 229f56a

Please sign in to comment.