diff --git a/HACKING/README.md b/HACKING/README.md index 48f77d1..96a8f53 100644 --- a/HACKING/README.md +++ b/HACKING/README.md @@ -4,6 +4,8 @@ 2. Follow the _Podman Environment Instructions_ to set up a Podman dev environment. If you'd like to run Proxstar entirely on your own hardware, check out _Setting up a full dev environment_ +If you'd like, you can also install the hooks by running `install_hooks.sh` from this directory. + 3. Create a Virtualenv to do your linting in ``` mkdir venv diff --git a/HACKING/hooks/pre-commit b/HACKING/hooks/pre-commit new file mode 100755 index 0000000..cd8a269 --- /dev/null +++ b/HACKING/hooks/pre-commit @@ -0,0 +1,18 @@ +files="./**/*.py *.py" +# Check if any files need to be re-formatted +black --check --quiet $files +check_status=$? + +# Reformat the files +black $files + +if [ $check_status -ne 0 ]; then +# Check if Black made any changes + echo "Black has reformatted files." + echo "Please review the changes and run 'git add' to stage them." + exit 1 +fi + +# If no issues were found, exit successfully +echo "All files are properly formatted." +exit 0 diff --git a/HACKING/install_hooks.sh b/HACKING/install_hooks.sh new file mode 100755 index 0000000..a9871e5 --- /dev/null +++ b/HACKING/install_hooks.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +set -euo pipefail + +ln -sf $(pwd)/hooks/* ../.git/hooks/ + diff --git a/config.py b/config.py index 30270fe..f2721d1 100644 --- a/config.py +++ b/config.py @@ -50,10 +50,7 @@ # REDIS REDIS_HOST = environ.get('PROXSTAR_REDIS_HOST', 'localhost') -RQ_DASHBOARD_REDIS_URL = ( - "redis://" + environ.get('PROXSTAR_REDIS_HOST', 'localhost') + ":" + - environ.get('PROXSTAR_REDIS_PORT', '6379') + "/0" -) +RQ_DASHBOARD_REDIS_URL = f"redis://{environ.get('PROXSTAR_REDIS_HOST', 'localhost')}:{environ.get('PROXSTAR_REDIS_PORT', '6379')}/0" REDIS_PORT = int(environ.get('PROXSTAR_REDIS_PORT', '6379')) # VNC