moved config to on file to load and to keep secret

This commit is contained in:
Jadowyne Ulve 2025-08-03 19:40:07 -05:00
parent faf75e6e98
commit 8192018e0c
5 changed files with 31 additions and 17 deletions

3
.gitignore vendored
View File

@ -3,4 +3,5 @@ sites
static/css/uikit-rtl.css
static/css/uikit-rtl.min.css
static/css/uikit.css
static/css/uikit.min.css
static/css/uikit.min.css
instance/application.cfg.py

View File

@ -161,7 +161,8 @@ def uploadImage(recipe_id):
def get_image(recipe_id):
site_name = session['selected_site']
picture_path = database_recipes.getPicturePath(site_name, (recipe_id,))
return send_from_directory('static/pictures/recipes', picture_path)
path = f"{current_app.config['UPLOAD_FOLDER']}/recipes"
return send_from_directory(path, picture_path)
@recipes_api.route('/deleteRecipeItem', methods=["POST"])
@access_api.login_required

View File

@ -1,3 +1,18 @@
VAPID_PUBLIC_KEY = "BIbaHOqZcTunzAeb9p1hCWBo1DeJN0NVf2WVNSrsLZ2e50vhBno5dJuRAB1NLNXIeeQYr_x-1fSifJBGfUKd6QM"
VAPID_PRIVATE_KEY = "l2wLDKWJDMkytDSN8s9iu9Y3-5qrIMy_OreUC3vDHtI"
VAPID_CLAIM_EMAIL = "jadowyne.ulve@outlook.com"
VAPID_CLAIM_EMAIL = "jadowyne.ulve@outlook.com"
APP_SECRET = "11gs22h2h1a4h6ah8e413a45"
UPLOAD_FOLDER = "E:/code/pantry-track/uploads"
FILES_FOLDER = "E:/code/pantry-track/files"
OAUTH_NAME = "authentik"
OAUTH_CLIENT_ID = "gh8rLyXC6hfI7W5mDX26OJFGHxmU0nMzeYl3B04G"
OAUTH_CLIENT_SECRET = "aRHyAkDDeU22s69Ig0o7f46Xn3HCnB8guZoMHuA23B7x1e2YL8FhAqZbu1f3naiaLyTLi9ICIiBc6dxOp5eIO4fEI9paL2NwKXmqYCRmzNzWAfwmcsIh2qTlQfAfsh6e"
OAUTH_ACCESS_TOKEN_URL = "https://auth.treehousefullofstars.com/application/o/token/"
OAUTH_AUTHORIZE_URL = "https://auth.treehousefullofstars.com/application/o/authorize/"
OAUTH_USERINFO_ENDPOINT = "https://auth.treehousefullofstars.com/application/o/userinfo/"
OAUTH_API_BASE_URL = "https://auth.treehousefullofstars.com/application/o/"
OAUTH_JWKS_URI = "https://auth.treehousefullofstars.com/application/o/pantry/jwks/"
OAUTH_CLIENT_KWARGS = {'scope': 'openid profile email'}

View File

@ -18,27 +18,24 @@ from outh import oauth
app = Flask(__name__, instance_relative_config=True)
oauth.init_app(app)
swagger = Swagger(app)
UPLOAD_FOLDER = 'static/pictures'
FILES_FOLDER = 'static/files'
app.config.from_pyfile('application.cfg.py')
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
app.config['FILES_FOLDER'] = FILES_FOLDER
print(app.config['UPLOAD_FOLDER'])
oauth.register(
name='authentik',
client_id='gh8rLyXC6hfI7W5mDX26OJFGHxmU0nMzeYl3B04G',
client_secret='aRHyAkDDeU22s69Ig0o7f46Xn3HCnB8guZoMHuA23B7x1e2YL8FhAqZbu1f3naiaLyTLi9ICIiBc6dxOp5eIO4fEI9paL2NwKXmqYCRmzNzWAfwmcsIh2qTlQfAfsh6e',
access_token_url="https://auth.treehousefullofstars.com/application/o/token/",
authorize_url="https://auth.treehousefullofstars.com/application/o/authorize/",
userinfo_endpoint="https://auth.treehousefullofstars.com/application/o/userinfo/",
api_base_url="https://auth.treehousefullofstars.com/application/o/",
jwks_uri="https://auth.treehousefullofstars.com/application/o/pantry/jwks/",
client_kwargs={'scope': 'openid profile email'},
name=app.config['OAUTH_NAME'],
client_id=app.config['OAUTH_CLIENT_ID'],
client_secret=app.config['OAUTH_CLIENT_SECRET'],
access_token_url=app.config['OAUTH_ACCESS_TOKEN_URL'],
authorize_url=app.config['OAUTH_AUTHORIZE_URL'],
userinfo_endpoint=app.config['OAUTH_USERINFO_ENDPOINT'],
api_base_url=app.config['OAUTH_API_BASE_URL'],
jwks_uri=app.config['OAUTH_JWKS_URI'],
client_kwargs=app.config['OAUTH_CLIENT_KWARGS'],
)
assets = Environment(app)
app.secret_key = '11gs22h2h1a4h6ah8e413a45'
app.secret_key = app.config['APP_SECRET']
app.register_blueprint(access_api.access_api, url_prefix="/access")
app.register_blueprint(administration_api.admin_api, url_prefix='/administration')
app.register_blueprint(items_API.items_api, url_prefix='/items')