diff --git a/CHANGELOG.md b/CHANGELOG.md index e86fb56..a79e835 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a changelog](https://github.com/olivierlacan/keep-a-changelog). ## [Unreleased](https://github.com/idealista/prom2teams/tree/develop) +## [4.2.1](https://github.com/idealista/prom2teams/tree/4.2.1) +[Full Changelog](https://github.com/idealista/prom2teams/compare/4.2.0...4.2.1) +### Fixed +- *[#307](https://github.com/idealista/prom2teams/pull/307) Update prom2teams replace_config with tmp config files* @santi-eidu ## [4.2.0](https://github.com/idealista/prom2teams/tree/4.2.0) [Full Changelog](https://github.com/idealista/prom2teams/compare/4.1.0...4.2.0) ### Added diff --git a/docker/rootfs/config.ini b/docker/rootfs/config.ini.tmp similarity index 100% rename from docker/rootfs/config.ini rename to docker/rootfs/config.ini.tmp diff --git a/docker/rootfs/prom2teams_start.sh b/docker/rootfs/prom2teams_start.sh index f68c534..6ae4230 100644 --- a/docker/rootfs/prom2teams_start.sh +++ b/docker/rootfs/prom2teams_start.sh @@ -1,3 +1,12 @@ #!/bin/sh python /opt/prom2teams/replace_config.py -uwsgi /opt/prom2teams/uwsgi.ini \ No newline at end of file + +if [ ! -f "/opt/prom2teams/config.ini" ]; then + mv /opt/prom2teams/config.ini.tmp /opt/prom2teams/config.ini +fi + +if [ ! -f "/opt/prom2teams/uwsgi.ini" ]; then + mv /opt/prom2teams/uwsgi.ini.tmp /opt/prom2teams/uwsgi.ini +fi + +uwsgi /opt/prom2teams/uwsgi.ini diff --git a/docker/rootfs/replace_config.py b/docker/rootfs/replace_config.py index 3bf545e..3866818 100644 --- a/docker/rootfs/replace_config.py +++ b/docker/rootfs/replace_config.py @@ -1,7 +1,7 @@ #!/usr/bin/env python import os -with open('/opt/prom2teams/config.ini', 'r') as file: +with open('/opt/prom2teams/config.ini.tmp', 'r') as file: filedata = file.read() filedata = filedata.replace("prom2teamsport", os.environ.get("PROM2TEAMS_PORT")) @@ -10,10 +10,11 @@ filedata = filedata.replace("prom2teamsgroupalertsby", os.environ.get("PROM2TEAMS_GROUP_ALERTS_BY")) filedata = filedata.replace("prom2teamslogslevel", os.environ.get("PROM2TEAMS_LOGLEVEL")) -with open('/opt/prom2teams/config.ini', 'w') as file: + +with open('/opt/prom2teams/config.ini.tmp', 'w') as file: file.write(filedata) -with open('/opt/prom2teams/uwsgi.ini', 'r') as file: +with open('/opt/prom2teams/uwsgi.ini.tmp', 'r') as file: uwsgi_filedata = file.read() uwsgi_filedata = uwsgi_filedata.replace("uwsgiprocesses", os.environ.get("UWSGI_PROCESSES")) @@ -22,6 +23,5 @@ uwsgi_filedata = uwsgi_filedata.replace("uwsgihost", os.environ.get("UWSGI_HOST")) uwsgi_filedata = uwsgi_filedata.replace("uwsgiprotocol", os.environ.get("UWSGI_PROTOCOL")) - -with open('/opt/prom2teams/uwsgi.ini', 'w') as file: +with open('/opt/prom2teams/uwsgi.ini.tmp', 'w') as file: file.write(uwsgi_filedata) diff --git a/docker/rootfs/uwsgi.ini b/docker/rootfs/uwsgi.ini.tmp similarity index 100% rename from docker/rootfs/uwsgi.ini rename to docker/rootfs/uwsgi.ini.tmp