From a50ca2e067424bd98637c72ccf31c7f69df3d7fe Mon Sep 17 00:00:00 2001 From: Disassembler Date: Tue, 20 Feb 2018 20:57:04 +0100 Subject: [PATCH] Add Ushahidi mobile app support config, closes #133 --- basic/srv/portal/index.html | 3 +++ ushahidi.sh | 3 ++- ushahidi/etc/init.d/ushahidi | 1 + ushahidi/srv/ushahidi/conf/config.json | 6 ++++++ ushahidi/srv/ushahidi/update-ip.sh | 5 ++++- 5 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 ushahidi/srv/ushahidi/conf/config.json diff --git a/basic/srv/portal/index.html b/basic/srv/portal/index.html index 486c46f..0920dd4 100644 --- a/basic/srv/portal/index.html +++ b/basic/srv/portal/index.html @@ -157,6 +157,9 @@ IOSIOS 9.0 a vyšší
AndroidAndroid 4.4 a vyšší

+
diff --git a/ushahidi.sh b/ushahidi.sh index 7da0c34..8f36294 100755 --- a/ushahidi.sh +++ b/ushahidi.sh @@ -17,6 +17,7 @@ envsubst <${SOURCE_DIR}/createdb.sql | docker exec -i mariadb mysql mkdir -p /srv/ushahidi/conf /srv/ushahidi/data chown 8014:8014 /srv/ushahidi/data envsubst <${SOURCE_DIR}/srv/ushahidi/conf/env >/srv/ushahidi/conf/env +cp ${SOURCE_DIR}/srv/ushahidi/conf/config.json /srv/ushahidi/conf/config.json cp ${SOURCE_DIR}/srv/ushahidi/update-ip.sh /srv/ushahidi/update-ip.sh # Populate database @@ -42,4 +43,4 @@ cp ${SOURCE_DIR}/etc/periodic/15min/ushahidi /etc/periodic/15min/ushahidi # Add portal application definition portal-app-manager ushahidi "https://{host}:8414/" "${USHAHIDI_ADMIN_USER}" "${USHAHIDI_ADMIN_PWD}" -portal-app-manager ushahidi-mobile +portal-app-manager ushahidi-mobile -p clienturl "{host}:8814" diff --git a/ushahidi/etc/init.d/ushahidi b/ushahidi/etc/init.d/ushahidi index b0de0f3..db070c7 100755 --- a/ushahidi/etc/init.d/ushahidi +++ b/ushahidi/etc/init.d/ushahidi @@ -19,6 +19,7 @@ start() { --link postfix \ -p 127.0.0.1:8014:8014 \ -v /srv/ushahidi/conf/env:/srv/ushahidi/platform/.env \ + -v /srv/ushahidi/conf/config.json:/srv/ushahidi/config.json \ -v /srv/ushahidi/data:/srv/ushahidi/platform/application/media/uploads \ ushahidi } diff --git a/ushahidi/srv/ushahidi/conf/config.json b/ushahidi/srv/ushahidi/conf/config.json new file mode 100644 index 0000000..77095cc --- /dev/null +++ b/ushahidi/srv/ushahidi/conf/config.json @@ -0,0 +1,6 @@ +{ + "backend_url": "http://127.0.0.1/platform", + "client_id": "ushahidiui", + "client_secret": "35e7f0bca957836d05ca0492211b0ac707671261", + "google_analytics_id": "AIzaSyBvIF3D550tlpL6o1xRrDurGo-81VhHlOw" +} diff --git a/ushahidi/srv/ushahidi/update-ip.sh b/ushahidi/srv/ushahidi/update-ip.sh index d3d4f24..4ff60a0 100755 --- a/ushahidi/srv/ushahidi/update-ip.sh +++ b/ushahidi/srv/ushahidi/update-ip.sh @@ -1,5 +1,8 @@ #!/bin/sh URL=$(ip route get 1 | awk '{print $NF;exit}') -FULL_URL='\\\"https:\\\\/\\\\/'${URL}:8413'\\\\/platform\\\\/api\\\\/v3\\\\/config\\\\/data-provider\\\"' + +sed -i "s|^ \"backend_url\".*| \"backend_url\": \"http://${URL}:8814/platform\",|" /srv/ushahidi/conf/config.json + +FULL_URL='\\\"https:\\\\/\\\\/'${URL}:8414'\\\\/platform\\\\/api\\\\/v3\\\\/config\\\\/data-provider\\\"' echo 'UPDATE `config` SET `config_value` = "'${FULL_URL}'" WHERE `group_name` LIKE "data-provider" AND `config_key` LIKE "url";' | docker exec -i mariadb mysql ushahidi