Integrate forgotten update-url.sh

This commit is contained in:
Disassembler 2018-09-18 15:18:29 +02:00
parent b0fe54d034
commit fc99f7f6ab
Signed by: Disassembler
GPG Key ID: 524BD33A0EE29499
4 changed files with 14 additions and 11 deletions

View File

@ -288,7 +288,7 @@ class VMMgr:
def update_apps_urls(self):
# Update configuration for respective applications
confupdater.update_url(tools.compile_url(self.domain, self.port, None))
confupdater.update_url(self.domain, self.port)
# Restart currently running apps in order to update config and re-register nginx proxy
for app in self.conf['apps']:
if tools.is_service_started(app):

View File

@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
# TODO: Rewrite back to individual files
import os
import shutil
import subprocess
@ -111,13 +113,23 @@ def update_email(email):
query = 'UPDATE `config` SET `config_value` = "\\"{}\\"" WHERE `group_name` LIKE "site" AND `config_key` LIKE "email";'.format(email)
run_mysql_query(query, 'ushahidi')
def update_url(host):
def update_url(domain, port):
host = tools.compile_url(domain, port, None)
# CKAN
if app_exists('ckan'):
replace_file_line('/srv/ckan/conf/ckan.ini', 'ckan.site_url = ', 'https://ckan.{}'.format(host))
# Mifos X
if app_exists('mifosx'):
replace_file_line('/srv/mifosx/conf/server.xml', ' proxyName=', '"{}"'.format(domain))
replace_file_line('/srv/mifosx/conf/server.xml', ' proxyPort=', '"{}"'.format(port))
# Motech
if app_exists('motech'):
replace_file_line('/srv/motech/conf/config/motech-settings.properties', 'server.url=', 'https://motech.{}'.format(host))
# OpenDataKit
if app_exists('opendatakit'):
replace_file_line('/srv/opendatakit/conf/server.xml', ' proxyName=', '"{}"'.format(domain))
replace_file_line('/srv/opendatakit/conf/server.xml', ' proxyPort=', '"{}"'.format(port))
replace_file_line('/srv/opendatakit/conf/security.properties', 'security.server.securePort=', port)
# Pan.do/ra
if app_exists('pandora'):
replace_file_line('/srv/pandora/conf/config.jsonc', ' "url": ', '"pandora.{}"'.format(host))

View File

@ -1,4 +0,0 @@
#!/bin/sh
sed -i "s|\(^\s\+proxyName\).*|\1=\"${1}\"|g" /srv/mifosx/conf/server.xml
sed -i "s|\(^\s\+proxyPort\).*|\1=\"${2}\"|g" /srv/mifosx/conf/server.xml

View File

@ -1,5 +0,0 @@
#!/bin/sh
sed -i "s|\(^\s\+proxyName\).*|\1=\"${1}\"|g" /srv/opendatakit/conf/server.xml
sed -i "s|\(^\s\+proxyPort\).*|\1=\"${2}\"|g" /srv/opendatakit/conf/server.xml
sed -i "s|^security\.server\.securePort.*|security.server.securePort=${2}|" /srv/opendatakit/conf/security.properties