Commit 4e59d410 authored by Gerald Salin's avatar Gerald Salin
Browse files

#82 adds protocl http/https in config to access the server

parent 1eee80af
...@@ -28,6 +28,8 @@ server_socket_host = 127.0.0.1 ...@@ -28,6 +28,8 @@ server_socket_host = 127.0.0.1
# on which socket port should run the web server # on which socket port should run the web server
server_socket_port = 8080 server_socket_port = 8080
#server_socket_port = 8083 #server_socket_port = 8083
# protocol used to access web server (http|https)
server_socket_protocol = https
# date format # date format
date_format = %d/%m/%Y date_format = %d/%m/%Y
# data retention time (in years) # data retention time (in years)
......
...@@ -112,7 +112,7 @@ class JFlowConfigReader(object): ...@@ -112,7 +112,7 @@ class JFlowConfigReader(object):
def get_socket_options(self): def get_socket_options(self):
try: try:
return [self.reader.get("global", "server_socket_host"), int(self.reader.get("global", "server_socket_port"))] return [self.reader.get("global", "server_socket_host"), int(self.reader.get("global", "server_socket_port"), self.reader.get("global", "server_socket_protocol"))]
except: except:
return ["127.0.0.1", 8080] return ["127.0.0.1", 8080]
......
...@@ -530,7 +530,7 @@ class JFlowServer (object): ...@@ -530,7 +530,7 @@ class JFlowServer (object):
socket_opt = self.jflow_config_reader.get_socket_options() socket_opt = self.jflow_config_reader.get_socket_options()
if not os.path.isdir(path): if not os.path.isdir(path):
return { return {
'url':'http://' + socket_opt[0] + ':' + str(socket_opt[1]) + '/' + path.replace(work_dir, web_path), 'url':socket_opt[2]+'://' + socket_opt[0] + ':' + str(socket_opt[1]) + '/' + path.replace(work_dir, web_path),
'size': get_octet_string_representation(os.path.getsize(os.path.abspath(path))), 'size': get_octet_string_representation(os.path.getsize(os.path.abspath(path))),
'extension': os.path.splitext(path)[1] 'extension': os.path.splitext(path)[1]
} }
......
...@@ -165,6 +165,7 @@ class NG6ConfigReader(object): ...@@ -165,6 +165,7 @@ class NG6ConfigReader(object):
server_params = [] server_params = []
server_params.append(self.reader.get('global', 'server_socket_host')) server_params.append(self.reader.get('global', 'server_socket_host'))
server_params.append(self.reader.get('global', 'server_socket_port')) server_params.append(self.reader.get('global', 'server_socket_port'))
server_params.append(self.reader.get("global", 'server_socket_protocol'))
return server_params return server_params
# except : # except :
# raise Error("Failed when parsing the config file !") # raise Error("Failed when parsing the config file !")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment