mirror of
https://github.com/Fluffy-Bean/GameExpo23.git
synced 2025-05-21 18:44:54 +00:00
Add enviroment variables
This commit is contained in:
parent
dbd6a81c78
commit
fda3fcc28c
5 changed files with 17 additions and 9 deletions
|
@ -1,4 +1,3 @@
|
|||
expo.leggy.dev {
|
||||
reverse_proxy highscore:8080
|
||||
encode gzip
|
||||
}
|
||||
{$DOMAIN}
|
||||
reverse_proxy highscore:8080
|
||||
encode gzip
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
SECRET_KEY = 'dev'
|
||||
import os
|
||||
|
||||
SECRET_KEY = os.getenv('SECRET_KEY')
|
||||
BEARER_TOKEN = os.getenv('BEARER_TOKEN')
|
||||
|
||||
SQLALCHEMY_DATABASE_URI = 'sqlite:///db.sqlite'
|
||||
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||
|
|
|
@ -4,4 +4,4 @@ from flask_caching import Cache
|
|||
|
||||
db = SQLAlchemy()
|
||||
migrate = Migrate()
|
||||
cache = Cache()
|
||||
cache = Cache(config={'CACHE_TYPE': 'simple'})
|
||||
|
|
|
@ -5,6 +5,8 @@ from wtforms.validators import DataRequired
|
|||
|
||||
from models import Scores, Users
|
||||
from extensions import db, cache
|
||||
from config import BEARER_TOKEN
|
||||
|
||||
|
||||
blueprint = Blueprint('views', __name__)
|
||||
|
||||
|
@ -63,7 +65,7 @@ def post():
|
|||
|
||||
if not form:
|
||||
return "Invalid form", 400
|
||||
if request.headers.get('Authentication') != 'Bearer 1234':
|
||||
if request.headers.get('Authentication') != 'Bearer ' + BEARER_TOKEN:
|
||||
return "Invalid authentication", 401
|
||||
|
||||
if not isinstance(form.score.data, int):
|
||||
|
@ -91,5 +93,3 @@ def post():
|
|||
db.session.add(score)
|
||||
db.session.commit()
|
||||
return jsonify({'message': 'Success!'})
|
||||
|
||||
|
||||
|
|
|
@ -10,6 +10,9 @@ services:
|
|||
- ./Caddy/Caddyfile:/etc/caddy/Caddyfile
|
||||
- ./Caddy/data:/data
|
||||
- ./Caddy/config:/config
|
||||
environment:
|
||||
- ACME_AGREE=true
|
||||
- DOMAIN=expo.leggy.dev
|
||||
links:
|
||||
- highscore
|
||||
|
||||
|
@ -17,3 +20,6 @@ services:
|
|||
build: ./Highscore-Server
|
||||
volumes:
|
||||
- ./Highscore-Server/data:/data/storage
|
||||
environment:
|
||||
- FLASK_KEY=secret
|
||||
- BEARER_TOKEN=1234
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue