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
This commit is contained in:
2025-08-11 16:21:13 +07:00
parent d9f184d084
commit 877ef951b2
4 changed files with 195 additions and 9 deletions

6
.env
View File

@@ -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

9
.env.example Normal file
View File

@@ -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

180
.gitignore vendored Normal file
View File

@@ -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/

View File

@@ -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) - Go to [Discogs Developer Settings](https://www.discogs.com/settings/developers)
- Create a new application or use an existing one - Create a new application or use an existing one
- Generate a User Token - Generate a User Token
- Copy the `.env` file and add your token: - Copy the example environment file and add your token:
```bash ```bash
# Edit .env file # Copy the example file
DISCOGS_USER_TOKEN=your_discogs_user_token_here 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 DISCOGS_USER_AGENT=YourAppName/1.0 +http://yourwebsite.com
``` ```