mirror of
https://github.com/OpenMTC/OpenMTC.git
synced 2024-12-25 07:31:12 +00:00
1052fd4a08
* Test debian stretch+python3 (#18) * changes starting with python3 explicit * removes python modules which are not available for python3 * exchanges fyzz query parsing with rdflib functionality * fixes interop tests * replaces reduce with for loop in nodb driver * simple python2 -> python3 conversions * adds changes for handling different string handling in python3 * test stretch building with travis * installing python-setuptools in docker * installing python-setuptools in docker * changing python2 to python3 in docker makefiles * changing python2 to python3 and some other test changes * push docker only in master branche * running version of openmtc * fix some port problems * porting path library completly now * restoring travis.yml * testing new travis.yml * add sudo * updating travis OS from trusty to xenial * upgrade pip before * show running docker logs * show more logs * for debugging * showlogs of docker after failure * testing new travis.yml * finish travis.yml * Adding roadmap (#26) * adding roadmap * adding a nicer view for some documents * creating contributions.md (#27) * travis only building on master branch (#25) * deleting some typo * another typo * adding a contributer * bump version to 1.3.0 * better link for contributions * Port and fix simple apps * add version tag
74 lines
2.0 KiB
Bash
Executable File
74 lines
2.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
CONFIG_FILE="/etc/openmtc/influxdbapp/config.json"
|
|
|
|
NAME=${NAME-"InfluxdbApp"}
|
|
EP=${EP-"http://localhost:8000"}
|
|
CSE_BASE=${CSE_BASE-"onem2m"}
|
|
POAS=${POAS-'["http://auto:23706"]'}
|
|
ORIGINATOR_PRE=${ORIGINATOR_PRE-"//openmtc.org/mn-cse-1"}
|
|
SSL_CRT=${SSL_CRT-"/etc/openmtc/certs/influxdb.cert.pem"}
|
|
SSL_KEY=${SSL_KEY-"/etc/openmtc/certs/influxdb.key.pem"}
|
|
SSL_CA=${SSL_CA-"/etc/openmtc/certs/ca-chain.cert.pem"}
|
|
LABELS=${LABELS-'[]'}
|
|
INFLUX_HOST=${INFLUX_HOST-"localhost"}
|
|
INFLUX_PORT=${INFLUX_PORT-"8086"}
|
|
INFLUX_USER=${INFLUX_USER-"root"}
|
|
INFLUX_PASSWORD=${INFLUX_PASSWORD-"root"}
|
|
DBNAME=${DBNAME-"example"},
|
|
DBUSER=${DBUSER-"test"},
|
|
DBUSER_PW=${DBUSER_PW-"test"}
|
|
|
|
# defaults logging
|
|
LOGGING_FILE=${LOGGING_FILE-"/var/log/openmtc/influxdbapp.log"}
|
|
LOGGING_LEVEL=${LOGGING_LEVEL-"ERROR"}
|
|
|
|
# ensure correct level
|
|
case ${LOGGING_LEVEL} in
|
|
FATAL|ERROR|WARN|INFO|DEBUG)
|
|
;;
|
|
*)
|
|
LOGGING_LEVEL="ERROR"
|
|
;;
|
|
esac
|
|
|
|
# local ip
|
|
LOCAL_IP=$(ip r get 8.8.8.8 | awk 'NR==1 {print $NF}')
|
|
|
|
# set hostname
|
|
HOST_NAME=${EXTERNAL_IP-${LOCAL_IP}}
|
|
|
|
# Configuration of the service.
|
|
CONFIG_TEMP=${CONFIG_FILE}".tmp"
|
|
echo -n "Configuring M2M influxdbapp..."
|
|
JQ_STRING='.'
|
|
|
|
# basics
|
|
JQ_STRING=${JQ_STRING}' |
|
|
.name = "'${NAME}'" |
|
|
.ep = "'${EP}'" |
|
|
.cse_base = "'${CSE_BASE}'" |
|
|
.poas = '${POAS}' |
|
|
.originator_pre = "'${ORIGINATOR_PRE}'" |
|
|
.ssl_certs.cert_file = "'${SSL_CRT}'" |
|
|
.ssl_certs.key_file = "'${SSL_KEY}'" |
|
|
.ssl_certs.ca_certs = "'${SSL_CA}'" |
|
|
.logging.file |= "'${LOGGING_FILE}'" |
|
|
.logging.level |= "'${LOGGING_LEVEL}'" |
|
|
.labels |= '${LABELS}' |
|
|
.influx_host = "'${INFLUX_HOST}'" |
|
|
.influx_port = "'${INFLUX_PORT}'" |
|
|
.influx_user = "'${INFLUX_USER}'" |
|
|
.influx_password = "'${INFLUX_PASSWORD}'" |
|
|
.dbname = "'${DBNAME}'" |
|
|
.dbuser = "'${DBUSER}'" |
|
|
.dbuser_pw = "'${DBUSER_PW}'"
|
|
'
|
|
|
|
cat ${CONFIG_FILE} | jq -M "${JQ_STRING}"> ${CONFIG_TEMP}
|
|
mv ${CONFIG_TEMP} ${CONFIG_FILE}
|
|
|
|
echo "done"
|
|
|
|
exec python3 -m influxdbapp $@
|