From 524fc6ef54369b58ffc1ac3b281cc019756584f8 Mon Sep 17 00:00:00 2001 From: Arian Nasr Date: Tue, 10 Mar 2026 12:09:57 -0400 Subject: [PATCH] mv conf vars external --- .env.example | 3 +++ .gitignore | 3 ++- main.py | 6 ++++-- 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..1fa44db --- /dev/null +++ b/.env.example @@ -0,0 +1,3 @@ +NAVIDROME_MUSIC_FOLDER="/opt/navidrome/music" +BIND_ADDRESS="192.168.2.24" +BIND_PORT="5001" \ No newline at end of file diff --git a/.gitignore b/.gitignore index 1814433..a9de651 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ venv/ setup.sh navidrome-upload.service -.idea/ \ No newline at end of file +.idea/ +.env diff --git a/main.py b/main.py index c36f648..859ef7d 100644 --- a/main.py +++ b/main.py @@ -6,7 +6,9 @@ import os from flask import Flask, request, render_template from werkzeug.utils import secure_filename -UPLOAD_FOLDER = '/opt/navidrome/music' +UPLOAD_FOLDER = os.environ.get('NAVIDROME_MUSIC_FOLDER', '/opt/navidrome/music') +BIND_ADDRESS = os.environ.get('BIND_ADDRESS', '0.0.0.0') +BIND_PORT = int(os.environ.get('BIND_PORT', 5001)) ALLOWED_EXTENSIONS = {'flac', 'mp3', 'wav'} app = Flask(__name__) @@ -36,4 +38,4 @@ def upload_file(): if __name__ == '__main__': - app.run(host='192.168.2.24', port=5001, debug=False) + app.run(host=BIND_ADDRESS, port=BIND_PORT, debug=False) -- 2.47.3