Netflox: read DB password from env; stop tracking archive with old password

database.py had the PostgreSQL password in plain text (inline literal repeated
in every psycopg2.connect call). It now reads NETFLOX_DB_PASSWORD once at
import time and raises RuntimeError if it is unset, so there is no default.

The committed Projeto_Netflox_*.zip embeds the same database.py and therefore
still carries the old password, so it is removed from the index
(git rm --cached; the file stays on disk outside the working tree). README.md
documents the env var and the archive removal.

Why: the credential must not live in the repository. The value is still in the
history and in any clone/cache, so it must be rotated.
This commit is contained in:
Andre Neto
2026-10-08 14:03:21 +01:00
parent 6509c6c5d6
commit 17f75eccb0
3 changed files with 60 additions and 29 deletions
+21
View File
@@ -0,0 +1,21 @@
# Netflox
## Configuration
The PostgreSQL password is **not** stored in the code. `database.py`
reads it once from the environment variable `NETFLOX_DB_PASSWORD`:
```bash
export NETFLOX_DB_PASSWORD='<your-postgres-password>'
python main.py
```
If the variable is missing or empty the script stops immediately with
a `RuntimeError`; there is no default. Do not commit the value back
into the repository, and see the rotation note in the project issue
tracker if the old password was ever pushed.
**Note:** `Projeto_Netflox_Alexandre_Almeida_Andre_Neto.zip` was removed from git
tracking because it contained a copy of `database.py` with the old password.
The archive still exists on disk but must not be committed again; regenerate it
without the password if it ever needs to be published.