Separate proxy port

master
Bob Mottram 2019-08-14 14:52:19 +01:00
parent 81c31616f1
commit 8f620566fc
3 changed files with 22 additions and 8 deletions

View File

@ -2663,7 +2663,7 @@ class PubServer(BaseHTTPRequestHandler):
def runDaemon(instanceId,clientToServer: bool, \ def runDaemon(instanceId,clientToServer: bool, \
baseDir: str,domain: str, \ baseDir: str,domain: str, \
port=80,httpPrefix='https', \ port=80,proxyPort=80,httpPrefix='https', \
fedList=[],noreply=False,nolike=False,nopics=False, \ fedList=[],noreply=False,nolike=False,nopics=False, \
noannounce=False,cw=False,ocapAlways=False, \ noannounce=False,cw=False,ocapAlways=False, \
useTor=False,maxReplies=64, \ useTor=False,maxReplies=64, \
@ -2676,7 +2676,7 @@ def runDaemon(instanceId,clientToServer: bool, \
print('Invalid domain: ' + domain) print('Invalid domain: ' + domain)
return return
serverAddress = ('', port) serverAddress = ('', proxyPort)
httpd = ThreadingHTTPServer(serverAddress, PubServer) httpd = ThreadingHTTPServer(serverAddress, PubServer)
# max POST size of 10M # max POST size of 10M
httpd.maxPostLength=1024*1024*10 httpd.maxPostLength=1024*1024*10
@ -2741,7 +2741,7 @@ def runDaemon(instanceId,clientToServer: bool, \
allowDeletion,debug,httpd.acceptedCaps),daemon=True) allowDeletion,debug,httpd.acceptedCaps),daemon=True)
httpd.thrInboxQueue.start() httpd.thrInboxQueue.start()
if clientToServer: if clientToServer:
print('Running ActivityPub client on ' + domain + ' port ' + str(port)) print('Running ActivityPub client on ' + domain + ' port ' + str(proxyPort))
else: else:
print('Running ActivityPub server on ' + domain + ' port ' + str(port)) print('Running ActivityPub server on ' + domain + ' port ' + str(proxyPort))
httpd.serve_forever() httpd.serve_forever()

View File

@ -99,6 +99,8 @@ parser.add_argument('-d','--domain', dest='domain', type=str,default=None, \
help='Domain name of the server') help='Domain name of the server')
parser.add_argument('-p','--port', dest='port', type=int,default=None, \ parser.add_argument('-p','--port', dest='port', type=int,default=None, \
help='Port number to run on') help='Port number to run on')
parser.add_argument('--proxy', dest='proxyPort', type=int,default=None, \
help='Proxy port number to run on')
parser.add_argument('--path', dest='baseDir', \ parser.add_argument('--path', dest='baseDir', \
type=str,default=os.getcwd(), \ type=str,default=os.getcwd(), \
help='Directory in which to store posts') help='Directory in which to store posts')
@ -376,6 +378,12 @@ if configPort:
else: else:
port=8085 port=8085
configProxyPort=getConfigParam(baseDir,'proxyPort')
if configProxyPort:
proxyPort=configProxyPort
else:
proxyPort=port
nickname=None nickname=None
if args.nickname: if args.nickname:
nickname=nickname nickname=nickname
@ -767,6 +775,9 @@ if args.domain:
if args.port: if args.port:
port=args.port port=args.port
setConfigParam(baseDir,'port',port) setConfigParam(baseDir,'port',port)
if args.proxyPort:
proxyPort=args.proxyPort
setConfigParam(baseDir,'proxyPort',proxyPort)
ocapAlways=False ocapAlways=False
if args.ocap: if args.ocap:
ocapAlways=args.ocap ocapAlways=args.ocap
@ -1247,7 +1258,7 @@ if args.testdata:
setConfigParam(baseDir,'admin',nickname) setConfigParam(baseDir,'admin',nickname)
runDaemon(instanceId,args.client,baseDir, \ runDaemon(instanceId,args.client,baseDir, \
domain,port,httpPrefix, \ domain,port,proxyPort,httpPrefix, \
federationList, \ federationList, \
args.noreply,args.nolike,args.nopics, \ args.noreply,args.nolike,args.nopics, \
args.noannounce,args.cw,ocapAlways, \ args.noannounce,args.cw,ocapAlways, \

View File

@ -191,7 +191,8 @@ def createServerAlice(path: str,domain: str,port: int,federationList: [], \
global testServerAliceRunning global testServerAliceRunning
testServerAliceRunning = True testServerAliceRunning = True
print('Server running: Alice') print('Server running: Alice')
runDaemon("instanceId",False,path,domain,port,httpPrefix,federationList, \ runDaemon("instanceId",False,path,domain,port,port, \
httpPrefix,federationList, \
noreply,nolike,nopics,noannounce,cw,ocapAlways, \ noreply,nolike,nopics,noannounce,cw,ocapAlways, \
useTor,maxReplies, \ useTor,maxReplies, \
domainMaxPostsPerDay,accountMaxPostsPerDay, \ domainMaxPostsPerDay,accountMaxPostsPerDay, \
@ -243,7 +244,8 @@ def createServerBob(path: str,domain: str,port: int,federationList: [], \
global testServerBobRunning global testServerBobRunning
testServerBobRunning = True testServerBobRunning = True
print('Server running: Bob') print('Server running: Bob')
runDaemon("instanceId",False,path,domain,port,httpPrefix,federationList, \ runDaemon("instanceId",False,path,domain,port,port, \
httpPrefix,federationList, \
noreply,nolike,nopics,noannounce,cw,ocapAlways, \ noreply,nolike,nopics,noannounce,cw,ocapAlways, \
useTor,maxReplies, \ useTor,maxReplies, \
domainMaxPostsPerDay,accountMaxPostsPerDay, \ domainMaxPostsPerDay,accountMaxPostsPerDay, \
@ -275,7 +277,8 @@ def createServerEve(path: str,domain: str,port: int,federationList: [], \
global testServerEveRunning global testServerEveRunning
testServerEveRunning = True testServerEveRunning = True
print('Server running: Eve') print('Server running: Eve')
runDaemon("instanceId",False,path,domain,port,httpPrefix,federationList, \ runDaemon("instanceId",False,path,domain,port,port, \
httpPrefix,federationList, \
noreply,nolike,nopics,noannounce,cw,ocapAlways, \ noreply,nolike,nopics,noannounce,cw,ocapAlways, \
useTor,maxReplies,allowDeletion,True) useTor,maxReplies,allowDeletion,True)