Skip to content

Commit

Permalink
Changing flask secret key to be read from environment (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
srh-sloan authored Sep 18, 2024
1 parent cc4b574 commit 319d2db
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
1 change: 0 additions & 1 deletion app/create_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
def create_app() -> Flask:

flask_app = Flask("__name__", static_url_path="/assets")
flask_app.secret_key = "dev" # pragma: allowlist secret
flask_app.register_blueprint(self_serve_bp)
flask_app.register_blueprint(dev_bp)
flask_app.register_blueprint(build_fund_bp)
Expand Down
2 changes: 2 additions & 0 deletions config/envs/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ class DefaultConfig(object):
# Logging
FSD_LOG_LEVEL = logging.WARNING

SECRET_KEY = getenv("SECRET_KEY")

FAB_HOST = getenv("FAB_HOST", "fab:8080/")
FAB_SAVE_PER_PAGE = getenv("FAB_SAVE_PER_PAGE", "dev/save")
FORM_RUNNER_URL = getenv("FORM_RUNNER_INTERNAL_HOST", "http://form-runner:3009")
Expand Down
2 changes: 2 additions & 0 deletions config/envs/development.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class DevelopmentConfig(Config):
# Logging
FSD_LOG_LEVEL = logging.DEBUG

SECRET_KEY = getenv("SECRET_KEY", "local")

SQLALCHEMY_DATABASE_URI = getenv(
"DATABASE_URL",
"postgresql://postgres:password@fab-db:5432/fab", # pragma: allowlist secret
Expand Down
2 changes: 2 additions & 0 deletions config/envs/unit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class UnitTestConfig(Config):
# Logging
FSD_LOG_LEVEL = logging.DEBUG

SECRET_KEY = getenv("SECRET_KEY", "unit_test")

SQLALCHEMY_DATABASE_URI = getenv(
"DATABASE_URL_UNIT_TEST",
"postgresql://postgres:[email protected]:5432/fab_unit_test", # pragma: allowlist secret
Expand Down

0 comments on commit 319d2db

Please sign in to comment.