Added minio stuff

This commit is contained in:
Pünkösd Marcell 2020-04-14 13:02:17 +02:00
parent e343469c6c
commit 43a0fe0ca2
2 changed files with 20 additions and 1 deletions

View File

@ -1,5 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import os import os
import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration
from flask import Flask from flask import Flask
from werkzeug.middleware.proxy_fix import ProxyFix from werkzeug.middleware.proxy_fix import ProxyFix
@ -11,11 +13,27 @@ from utils import register_all_error_handlers
# import views # import views
from views import ModelView from views import ModelView
# Setup sentry
SENTRY_DSN = os.environ.get("SENTRY_DSN")
if SENTRY_DSN:
sentry_sdk.init(
dsn=SENTRY_DSN,
integrations=[FlaskIntegration()],
send_default_pii=True,
release=os.environ.get('RELEASE_ID', 'test'),
environment=os.environ.get('RELEASEMODE', 'dev')
)
# create flask app # create flask app
app = Flask(__name__) app = Flask(__name__)
app.wsgi_app = ProxyFix(app.wsgi_app, x_proto=1) app.wsgi_app = ProxyFix(app.wsgi_app, x_proto=1)
# configure flask app # configure flask app
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('DATABASE_URI', "sqlite://") # Default to memory db app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('DATABASE_URI', "sqlite://") # Default to memory db
app.config['MINIO_ENDPOINT'] = os.environ['MINIO_ENDPOINT']
app.config['MINIO_ACCESS_KEY'] = os.environ['MINIO_ACCESS_KEY']
app.config['MINIO_SECRET_KEY'] = os.environ['MINIO_SECRET_KEY']
app.config['MINIO_BUCKET_NAME'] = os.environ['MINIO_BUCKET_NAME']
# important stuff # important stuff
app.secret_key = os.environ.get('SECRET_KEY', os.urandom(12)) app.secret_key = os.environ.get('SECRET_KEY', os.urandom(12))

View File

@ -8,4 +8,5 @@ SQLAlchemy-Utils
SQLAlchemy SQLAlchemy
marshmallow-sqlalchemy marshmallow-sqlalchemy
psycopg2-binary psycopg2-binary
flask_minio
sentry-sdk