Add app.py as pack host

This commit is contained in:
Nick Guy 2025-06-02 21:57:04 +01:00
parent fe92f62d3f
commit ac8f86791c
2 changed files with 28 additions and 0 deletions

27
app.py Normal file
View file

@ -0,0 +1,27 @@
import os
from pathlib import Path
from flask import Flask, send_from_directory, abort
app = Flask(__name__)
@app.route("/file/<name>")
def get_file(name):
if not os.path.exists("/scripts/files/" + name):
abort(404)
return send_from_directory("/scripts/files", name)
if __name__ == '__main__':
port = 8080
config_file = Path(__file__).parent / "config.properties"
if config_file.exists():
lines = config_file.read_text().splitlines()
for line in lines:
if "=" not in line: continue
key, value = line.split("=", 1)
if key == "port":
port = int(value)
app.run(host='0.0.0.0', port=port)

1
config.properties Normal file
View file

@ -0,0 +1 @@
port=25566