Skip to content

Commit

Permalink
Merge pull request #327 from idealista/develop
Browse files Browse the repository at this point in the history
Develop to Master
  • Loading branch information
santi-eidu committed Dec 21, 2022
2 parents d8d5952 + 340d47d commit 5299de6
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
11 changes: 10 additions & 1 deletion docker/rootfs/prom2teams_start.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
#!/bin/sh
python /opt/prom2teams/replace_config.py
uwsgi /opt/prom2teams/uwsgi.ini

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
10 changes: 5 additions & 5 deletions docker/rootfs/replace_config.py
Original file line number Diff line number Diff line change
@@ -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"))
Expand All @@ -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"))
Expand All @@ -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)
File renamed without changes.

0 comments on commit 5299de6

Please sign in to comment.