Skip to content

fix(fri): let startserver run without FLASK_SECRET_KEY set - #643

Open
Siddhanthguptaa wants to merge 1 commit into
ControlCore-Project:devfrom
Siddhanthguptaa:fix/startserver-out-of-box
Open

Siddhanthguptaa wants to merge 1 commit into
ControlCore-Project:devfrom
Siddhanthguptaa:fix/startserver-out-of-box

Conversation

@Siddhanthguptaa

Copy link
Copy Markdown

Fixes #642

Since #414 the server refuses to start without FLASK_SECRET_KEY (unless FLASK_ENV=development), but startserver and startserver.bat set neither, so they fail on a fresh checkout and then suggest reinstalling packages.

  • The launchers now set a throwaway FLASK_SECRET_KEY for that run, only when it isn't already set (bash: from /dev/urandom, bat: Python secrets). main.py is unchanged, so the check still applies to any other way of starting the server.
  • The error message now says the server exited with an error and keeps the pip hint for missing modules.
  • README: the sentence about the automatic key now says the launchers generate it.
  • startserver is now executable (it was 100644).

Why not set FLASK_ENV=development in the launchers: Flask is unpinned in fri/requirements.txt and older Flask versions also switch on debug mode from that variable; a random per-run key avoids that.

Testing (Windows 11, Python 3.11, both variables unset)

  • Before: RuntimeError: FLASK_SECRET_KEY environment variable must be set in production.
  • After: startserver.bat (cmd) and startserver (Git Bash) both start the server on :5000.
  • There are no automated tests for the launcher scripts.

main.py refuses to start without FLASK_SECRET_KEY unless FLASK_ENV is
development, and the launchers set neither, so startserver failed on a
fresh checkout and pointed users at pip. Set a throwaway key for the run
when none is set, fix the error hint and the README sentence, and make
startserver executable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant