Skip to content

feat(backend): make backend configurable via environment variables#186

Open
alikhere wants to merge 3 commits intoc2siorg:mainfrom
alikhere:feat/add-env-varible-for-backend
Open

feat(backend): make backend configurable via environment variables#186
alikhere wants to merge 3 commits intoc2siorg:mainfrom
alikhere:feat/add-env-varible-for-backend

Conversation

@alikhere
Copy link
Copy Markdown

Summary

Every configurable value in the Flask backend was hardcoded in main.py— host, port, debug mode, CORS origins, and output directory path. None of it could be changed without modifying source code directly.

Wired all five values to environment variables using os.environ.get() with the existing hardcoded values as defaults, so behaviour is completely unchanged when no .env is present:

  • FLASK_HOST / FLASK_PORT / FLASK_DEBUGapp.run()
  • CORS_ORIGINSCORS(app, origins=...)
  • OUTPUT_DIR → module-level variable used in start_gdb_session,
    compile_code, and upload_file

Also added gdbui_server/.env.example documenting all five variables, and a short Environment Variables section in README.md.

How to test

  • Copy the example and start the server — should behave exactly as before:
    cp gdbui_server/.env.example gdbui_server/.env && python main.py
  • Set FLASK_PORT=9999 in .env and restart — server should bind to 9999
  • Confirm tests still pass:
    cd gdbui_server && python -m unittest discover -s . -p 'flask_test.py'

Related Issue

Fixes #185

@alikhere alikhere force-pushed the feat/add-env-varible-for-backend branch from f13791c to 31f0081 Compare March 24, 2026 23:38
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.

feat: make backend configurable via environment variables

1 participant