diff --git a/Dockerfile b/Dockerfile index d319e1b..883ee21 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,6 +35,7 @@ ADD surveil /opt/surveil/surveil ENV PBR_VERSION=PROD # We are using develop so that the code can be mounted when in DEV. +RUN pip install -U six RUN cd /opt/surveil && python setup.py develop #Set to 'surveil' or 'keystone' diff --git a/etc/surveil/surveil.cfg b/etc/surveil/surveil.cfg new file mode 100644 index 0000000..1f9cc5b --- /dev/null +++ b/etc/surveil/surveil.cfg @@ -0,0 +1,4 @@ +[surveil] +mongodb_uri= mongodb://mongo:27017 +ws_arbiter_url= http://alignak:7760 +influxdb_uri= influxdb://root:root@influxdb:8086/db diff --git a/requirements.txt b/requirements.txt index ce9068a..581bc56 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,3 +9,4 @@ oslo.policy>=0.3.0 keystonemiddleware PasteDeploy influxdb==2.0.1 +six diff --git a/surveil/api/config.py b/surveil/api/config.py index c6d1c6e..6c78461 100644 --- a/surveil/api/config.py +++ b/surveil/api/config.py @@ -12,6 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. +from six.moves import configparser from surveil.api import hooks @@ -21,13 +22,13 @@ server = { 'host': '0.0.0.0' } +config = configparser.ConfigParser() +config.read("/etc/surveil/surveil.cfg") -# In the future, surveil_api_config could be loaded from somewhere else, -# as long as is it in the same format. surveil_api_config = { - "mongodb_uri": "mongodb://mongo:27017", - "ws_arbiter_url": "http://alignak:7760", - "influxdb_uri": "influxdb://root:root@influxdb:8086/db" + "mongodb_uri": config.get("surveil", "mongodb_uri"), + "ws_arbiter_url": config.get("surveil", "ws_arbiter_url"), + "influxdb_uri": config.get("surveil", "influxdb_uri") } app_hooks = [