Skip to content

Commit

Permalink
refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
Oloruntobi Olurombi committed Sep 12, 2024
1 parent b7a08d6 commit e3b5674
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 2 additions & 6 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import os
from flask import Flask
from flask_wtf.csrf import CSRFProtect
from config import Config

app = Flask(__name__)

secret_key = os.getenv('SECRET_KEY')
if secret_key is None:
raise ValueError("No SECRET_KEY set for Flask application. Please set the SECRET_KEY environment variable.")
app.config['SECRET_KEY'] = secret_key
app.config.from_object(Config)

csrf = CSRFProtect(app)

Expand Down
6 changes: 6 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# config.py
import os
import secrets

class Config:
SECRET_KEY = os.getenv('SECRET_KEY', secrets.token_urlsafe(32))

0 comments on commit e3b5674

Please sign in to comment.