dynamically fetch and use port

This commit is contained in:
Usman Nasir
2020-08-15 11:28:12 +05:00
parent 74b8f8cae2
commit 82c066a621
4 changed files with 14 additions and 6 deletions

View File

@@ -341,8 +341,8 @@ class emailMarketing(multi.Thread):
if (items.verificationStatus == 'Verified' or self.extraArgs[ if (items.verificationStatus == 'Verified' or self.extraArgs[
'verificationCheck']) and not items.verificationStatus == 'REMOVED': 'verificationCheck']) and not items.verificationStatus == 'REMOVED':
try: try:
port = ProcessUtilities.fetchCurrentPort()
removalLink = "https:\/\/" + ipAddress + ":8090\/emailMarketing\/remove\/" + self.extraArgs[ removalLink = "https:\/\/" + ipAddress + ":%s\/emailMarketing\/remove\/" % (port) + self.extraArgs[
'listName'] + "\/" + items.email 'listName'] + "\/" + items.email
messageText = emailMessage.emailMessage.encode('utf-8', 'replace') messageText = emailMessage.emailMessage.encode('utf-8', 'replace')
message['To'] = items.email message['To'] = items.email

View File

@@ -57,8 +57,10 @@ class backupSchedule:
file = open(pathToFile, "w+") file = open(pathToFile, "w+")
file.close() file.close()
port = ProcessUtilities.fetchCurrentPort()
finalData = json.dumps({'randomFile': pathToFile, 'websiteToBeBacked': virtualHost}) finalData = json.dumps({'randomFile': pathToFile, 'websiteToBeBacked': virtualHost})
r = requests.post("https://localhost:8090/backup/localInitiate", data=finalData, verify=False) r = requests.post("https://localhost:%s/backup/localInitiate" % (port), data=finalData, verify=False)
if os.path.exists(ProcessUtilities.debugPath): if os.path.exists(ProcessUtilities.debugPath):
logging.CyberCPLogFileWriter.writeToFile(r.text) logging.CyberCPLogFileWriter.writeToFile(r.text)

View File

@@ -1763,7 +1763,9 @@ class WebsiteManager:
ipData = f.read() ipData = f.read()
ipAddress = ipData.split('\n', 1)[0] ipAddress = ipData.split('\n', 1)[0]
webhookURL = 'https://' + ipAddress + ':8090/websites/' + self.domain + '/gitNotify' port = ProcessUtilities.fetchCurrentPort()
webhookURL = 'https://' + ipAddress + ':%s/websites/' % (port) + self.domain + '/gitNotify'
return render(request, 'websiteFunctions/setupGit.html', return render(request, 'websiteFunctions/setupGit.html',
{'domainName': self.domain, 'installed': 1, 'webhookURL': webhookURL}) {'domainName': self.domain, 'installed': 1, 'webhookURL': webhookURL})

View File

@@ -2054,7 +2054,9 @@ class WebsiteManager:
ipData = f.read() ipData = f.read()
ipAddress = ipData.split('\n', 1)[0] ipAddress = ipData.split('\n', 1)[0]
webhookURL = 'https://' + ipAddress + ':8090/websites/' + self.domain + '/gitNotify' port = ProcessUtilities.fetchCurrentPort()
webhookURL = 'https://' + ipAddress + ':%s/websites/' % (port) + self.domain + '/gitNotify'
return render(request, 'websiteFunctions/setupGit.html', return render(request, 'websiteFunctions/setupGit.html',
{'domainName': self.domain, 'installed': 1, 'webhookURL': webhookURL}) {'domainName': self.domain, 'installed': 1, 'webhookURL': webhookURL})
@@ -3131,7 +3133,9 @@ StrictHostKeyChecking no
## ##
webHookURL = 'https://%s:8090/websites/%s/webhook' % (ACLManager.fetchIP(), self.domain) port = ProcessUtilities.fetchCurrentPort()
webHookURL = 'https://%s:%s/websites/%s/webhook' % (ACLManager.fetchIP(), port, self.domain)
data_ret = {'status': 1, 'repo': 1, 'finalBranches': branches, 'deploymentKey': deploymentKey, data_ret = {'status': 1, 'repo': 1, 'finalBranches': branches, 'deploymentKey': deploymentKey,
'remote': remote, 'remoteResult': remoteResult, 'totalCommits': totalCommits, 'home': self.home, 'remote': remote, 'remoteResult': remoteResult, 'totalCommits': totalCommits, 'home': self.home,