read configs from env

This commit is contained in:
h z
2024-12-05 13:39:08 +00:00
parent 9d0fd5b33c
commit 178219f097
4 changed files with 32 additions and 28 deletions

13
app.py
View File

@@ -1,4 +1,6 @@
# app.py
from pprint import pprint
from logging_handlers.DatabaseLogHandler import DatabaseLogHandler
from urllib.parse import urlparse
from api import limiter
@@ -23,13 +25,13 @@ try:
except Exception as e:
print(f"db not ready {e}")
app = Flask(__name__)
app.config['SERVER_NAME'] = 'localhost:5000'
app.config['SERVER_NAME'] = env_provider.BACKEND_HOST
app.secret_key = env_provider.SESSION_SECRET_KEY
CORS(app, resources={r"/api/*": {"origins": [
"https://login.hangman-lab.top",
"https://git.hangman-lab.top",
"http://127.0.0.1:3000",
"http://localhost:3000",
env_provider.KC_HOST,
env_provider.FRONTEND_HOST,
r"https?://localhost:\d+",
r"https?://127\.0\.0\.1:\d+",
]}})
limiter.init_app(app)
@@ -45,4 +47,5 @@ def log_request():
if __name__ == '__main__':
#logger.info("Starting app")
pprint(env_provider.summerize())
app.run(host='0.0.0.0', port=5000)