diff --git a/README.md b/README.md index 6957d02..def6909 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ General commands (as anyone) Docker is the easiest way to install the master server. ```sh -docker run -d -p 5000:5000 -e LICENCE-API=your-api-key -e WORKER_KEY=your-api-key --name hnshosting-master git.woodburn.au/nathanwoodburn/hnshosting-master:latest -v ./data:/data +docker run -d -p 5000:5000 -e LICENCE_KEY=your-api-key -e WORKER_KEY=your-api-key -e ADMIN_KEY=admin-key --name hnshosting-master git.woodburn.au/nathanwoodburn/hnshosting-master:latest -v ./data:/data ``` You can also mount a docker volume to /data to store the files instead of mounting a host directory. diff --git a/master/main.py b/master/main.py index db60ed4..4755bf0 100644 --- a/master/main.py +++ b/master/main.py @@ -1,4 +1,4 @@ -from flask import Flask, request, jsonify +from flask import Flask, make_response, redirect, request, jsonify import dotenv import os import requests @@ -10,12 +10,14 @@ dotenv.load_dotenv() app = Flask(__name__) +loggins = [] + # API add license key (requires API key in header) @app.route('/add-licence', methods=['POST']) def add_license(): # Get API header api_key = request.headers.get('key') - if api_key != os.getenv('LICENCE-API'): + if api_key != os.getenv('LICENCE_KEY'): return jsonify({'error': 'Invalid API key', 'success': 'false'}) # Generate licence key @@ -441,7 +443,35 @@ def home(): html += "
Number of licences: " + str(len(licences)) + "
" + html += "