From 877ef951b2dbb4e37f7b8aefe87928eadacda2f3 Mon Sep 17 00:00:00 2001 From: grabowski Date: Mon, 11 Aug 2025 16:21:13 +0700 Subject: [PATCH] Add .gitignore and secure environment configuration - Added comprehensive .gitignore to prevent sensitive data commits - Removed .env from git tracking to protect API tokens - Created .env.example template for users to copy and configure - Updated README with secure setup instructions using .env.example - Prevents accidental exposure of Discogs API tokens and other secrets --- .env | 6 -- .env.example | 9 +++ .gitignore | 180 +++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 9 ++- 4 files changed, 195 insertions(+), 9 deletions(-) delete mode 100644 .env create mode 100644 .env.example create mode 100644 .gitignore diff --git a/.env b/.env deleted file mode 100644 index 91b2d8d..0000000 --- a/.env +++ /dev/null @@ -1,6 +0,0 @@ -# Discogs API Configuration -# Get your API key from: https://www.discogs.com/settings/developers -# DISCOGS_USER_TOKEN=your_discogs_user_token_here - -# Optional: Discogs User Agent (recommended) -# DISCOGS_USER_AGENT=YourAppName/1.0 +http://yourwebsite.com diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..9f887e7 --- /dev/null +++ b/.env.example @@ -0,0 +1,9 @@ +# Discogs API Configuration +# Get your API key from: https://www.discogs.com/settings/developers +# Copy this file to .env and add your actual tokens + +# Required: Your Discogs User Token +DISCOGS_USER_TOKEN=your_discogs_user_token_here + +# Optional: Custom User Agent (recommended) +DISCOGS_USER_AGENT=YourAppName/1.0 +http://yourwebsite.com diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5675346 --- /dev/null +++ b/.gitignore @@ -0,0 +1,180 @@ +# Environment variables and secrets +.env +.env.local +.env.production +.env.staging +*.env + +# Python +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# pipenv +Pipfile.lock + +# PEP 582 +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# IDEs +.vscode/ +.idea/ +*.swp +*.swo +*~ + +# OS generated files +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db + +# Logs +logs/ +*.log + +# Runtime data +pids/ +*.pid +*.seed +*.pid.lock + +# Coverage directory used by tools like istanbul +coverage/ + +# nyc test coverage +.nyc_output + +# Dependency directories +node_modules/ + +# Optional npm cache directory +.npm + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file (backup) +.env.backup +.env.example.backup + +# Temporary files +tmp/ +temp/ diff --git a/README.md b/README.md index 37c48f6..5556cb5 100644 --- a/README.md +++ b/README.md @@ -32,10 +32,13 @@ A FastAPI-based web application that allows users to search for different types - Go to [Discogs Developer Settings](https://www.discogs.com/settings/developers) - Create a new application or use an existing one - Generate a User Token - - Copy the `.env` file and add your token: + - Copy the example environment file and add your token: ```bash - # Edit .env file - DISCOGS_USER_TOKEN=your_discogs_user_token_here + # Copy the example file + cp .env.example .env + + # Edit .env file and add your actual token + DISCOGS_USER_TOKEN=your_actual_discogs_token_here DISCOGS_USER_AGENT=YourAppName/1.0 +http://yourwebsite.com ```