add cors
This commit is contained in:
3
.env
3
.env
@@ -1,6 +1,7 @@
|
|||||||
# Public hosts for routing via nginx-proxy
|
# Public hosts for routing via nginx-proxy
|
||||||
SOLARDB_API_HOST=db.northdanubesoft.eu
|
SOLARDB_API_HOST=db-api.northdanubesoft.eu
|
||||||
SOLARDB_UI_HOST=db.northdanubesoft.eu
|
SOLARDB_UI_HOST=db.northdanubesoft.eu
|
||||||
|
UI_ORIGIN=https://db.northdanubesoft.eu
|
||||||
|
|
||||||
LETSENCRYPT_EMAIL=macamete.robert@gmail.com
|
LETSENCRYPT_EMAIL=macamete.robert@gmail.com
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,17 @@ from flask import Flask, request, jsonify
|
|||||||
from tinydb import TinyDB, Query, where
|
from tinydb import TinyDB, Query, where
|
||||||
from tinydb.operations import set as ops_set
|
from tinydb.operations import set as ops_set
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
from flask_cors import CORS
|
||||||
import os
|
import os
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
UI_ORIGIN = os.getenv("UI_ORIGIN", "https://db.northdanubesoft.eu")
|
||||||
|
CORS(app, resources={r"/*": {"origins": [UI_ORIGIN]}})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Single TinyDB file for now (can be swapped to per-table later)
|
# Single TinyDB file for now (can be swapped to per-table later)
|
||||||
DB_PATH = os.getenv("DB_PATH", "db.json")
|
DB_PATH = os.getenv("DB_PATH", "db.json")
|
||||||
db = TinyDB(DB_PATH)
|
db = TinyDB(DB_PATH)
|
||||||
|
|||||||
Reference in New Issue
Block a user