This repository has been archived on 2023-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
authentic-old/authentic/ctl/start.py

38 lines
936 B
Python

import socket
import sys
from quixote.server.scgi_server import run
import authentic
def start(args):
port = 3002
extra_dirs = []
single_host = False
i = 0
while i < len(args):
if args[i] == '--port':
port = int(args[i+1])
i += 1
elif args[i] == '--extra':
authentic.AuthenticPublisher.register_extra_dir(args[i+1])
extra_dirs.append(args[i+1])
i += 1
elif args[i] == '--single-host':
single_host = True
i += 1
try:
if single_host:
run(authentic.create_publisher, port=port, script_name = '')
else:
run(authentic.create_vhost_publisher, port=port, script_name = '')
except socket.error, e:
if e[0] == 98:
print >> sys.stderr, 'address already in use'
sys.exit(1)
raise
except KeyboardInterrupt:
sys.exit(1)