mirror of https://github.com/Aidaho12/haproxy-wi
Update server.py
parent
f26c798cad
commit
b2e541007b
15
server.py
15
server.py
|
@ -1,11 +1,20 @@
|
|||
#!/usr/bin/env python3
|
||||
import os, sys
|
||||
import configparser
|
||||
|
||||
path_config = "/home/ploginov/haproxy/haproxy-webintarface.config"
|
||||
config = configparser.ConfigParser()
|
||||
config.read(path_config)
|
||||
log_path = config.get('main', 'log_path')
|
||||
fullpath = config.get('main', 'fullpath')
|
||||
server_bind_ip = config.get('main', 'server_bind_ip')
|
||||
server_port = config.getint('main', 'server_port')
|
||||
|
||||
from http.server import HTTPServer, CGIHTTPRequestHandler
|
||||
|
||||
sys.stderr = open('/opt/haproxy/log/haproxy-monitor.log', 'w')
|
||||
webdir = "/opt/haproxy"
|
||||
sys.stderr = open(log_path + '/opt/haproxy/log/haproxy-monitor.log', 'w')
|
||||
webdir = fullpath
|
||||
os.chdir(webdir)
|
||||
server_address = ("", 8000)
|
||||
server_address = (server_bind_ip, server_port)
|
||||
httpd = HTTPServer(server_address, CGIHTTPRequestHandler)
|
||||
httpd.serve_forever()
|
||||
|
|
Loading…
Reference in New Issue