diff --git a/.env.sample b/.env.sample new file mode 100644 index 0000000..9281d30 --- /dev/null +++ b/.env.sample @@ -0,0 +1 @@ +REBRICKABLE_API_KEY=xxxx diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..374272a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM python:slim +WORKDIR /app +COPY requirements.txt . +RUN pip install -r requirements.txt +COPY . . +CMD ["python", "app.py"] diff --git a/README.md b/README.md index 8aefa8f..ccf14fd 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,11 @@ # LEGOOrganizer +git clone + +`cp .env.sample .env` + +`nano .env` + +change api key and save file + +docker compose up -d diff --git a/app.py b/app.py index 6336380..2759f11 100644 --- a/app.py +++ b/app.py @@ -1,4 +1,5 @@ from flask import Flask, request, redirect, jsonify, render_template, Response,url_for +import os import json from flask_socketio import SocketIO from threading import Thread @@ -107,9 +108,10 @@ def new_set(set_num): # >>>>>>>> progress(count, total_parts,'Adding set: ' + set_num) - with open('api','r') as f: - api_key = f.read().replace('\n','') - rb = rebrick.init(api_key) + #with open('api','r') as f: + # api_key = f.read().replace('\n','') + # TODO add 401 error on wrong key + rb = rebrick.init(os.getenv("REBRICKABLE_API_KEY")) # >>>>>>>> progress(count, total_parts,'Generating Unique ID') diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..b4ceeea --- /dev/null +++ b/compose.yaml @@ -0,0 +1,10 @@ +services: + legoorganizer: + container_name: LEGOOrganizer + build: . + ports: + - "5111:3333" + volumes: + - .:/app + env_file: + - .env