You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
haproxy-wi/server.py

21 lines
664 B

7 years ago
#!/usr/bin/env python3
import os, sys
7 years ago
import configparser
7 years ago
path_config = "/opt/haproxy/haproxy-webintarface.config"
7 years ago
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')
7 years ago
from http.server import HTTPServer, CGIHTTPRequestHandler
7 years ago
sys.stderr = open(log_path + '/opt/haproxy/log/haproxy-monitor.log', 'w')
webdir = fullpath
7 years ago
os.chdir(webdir)
7 years ago
server_address = (server_bind_ip, server_port)
7 years ago
httpd = HTTPServer(server_address, CGIHTTPRequestHandler)
httpd.serve_forever()