Add env variable for timeout check

This commit is contained in:
2024-03-01 12:14:28 +01:00
parent 941d2a987e
commit 8cb7bea44c
2 changed files with 4 additions and 2 deletions

View File

@@ -9,7 +9,8 @@ RUN pip install -r requirements.txt
# Définir les variables d'environnement pour username et password
ENV USERNAME="" \
PASSWORD="" \
NTFY_URL=""
NTFY_URL="" \
GHNTFY_TIMEOUT="3600"
# Exécuter la commande pour générer l'authentification base64 à partir des variables d'environnement
RUN echo -n "$USERNAME:$PASSWORD" | base64 > /auth.txt

View File

@@ -58,13 +58,14 @@ if __name__ == "__main__":
with open('/auth.txt', 'r') as f:
auth = f.read().strip()
ntfy_url = os.environ.get('NTFY_URL')
timeout = float(os.environ.get('GHNTFY_TIMEOUT'))
if auth and ntfy_url:
while True:
latest_release = get_latest_releases(watched_repos_list)
if latest_release:
send_to_ntfy(latest_release, auth, ntfy_url)
time.sleep(3600) # Attendre une heure avant de vérifier à nouveau
time.sleep(timeout) # Attendre une heure avant de vérifier à nouveau
else:
print("Usage: python ntfy.py")
print("auth: can be generataed by the folowing command: echo -n 'username:password' | base64 and need to be stored in a file named auth.txt")