Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# JWT Configuration
# IMPORTANT: Generate a secure random secret key for production
# You can generate one with: openssl rand -hex 32
JWT_SECRET=your-secret-key-here-replace-in-production-min-32-chars
JWT_ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30

# Static User Configuration (MVP only - replace with real identity provider in production)
# Format: username:hashed_password (use bcrypt)
# Default user: admin / admin123 (CHANGE THIS IN PRODUCTION)
STATIC_USERS=admin:$2b$12$zTUL72EpStgcbdytol3L9eloCwzGZx4sCYA4rYC2snOdQtHYoNVp.

# Application Configuration
APP_HOST=0.0.0.0
APP_PORT=8000
DEBUG=false

# TODO: Replace static users with OAuth/OIDC integration for production
# OAUTH_CLIENT_ID=
# OAUTH_CLIENT_SECRET=
# OAUTH_AUTHORITY=
# OAUTH_REDIRECT_URI=
91 changes: 91 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: CI

on:
push:
branches: [ main, "copilot/*", "feature/*" ]
pull_request:
branches: [ main ]

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest

permissions:
contents: read

strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Cache pip packages
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Run tests with pytest
env:
JWT_SECRET: test-secret-key-for-ci
JWT_ALGORITHM: HS256
ACCESS_TOKEN_EXPIRE_MINUTES: 30
run: |
pytest tests/ -v --tb=short

- name: Test application startup
env:
JWT_SECRET: test-secret-key-for-ci
JWT_ALGORITHM: HS256
ACCESS_TOKEN_EXPIRE_MINUTES: 30
run: |
# Test that the application can start
timeout 5s python -m src.interfaces.web_api || true

lint:
runs-on: ubuntu-latest

permissions:
contents: read

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 black

- name: Lint with flake8
run: |
# Stop the build if there are Python syntax errors or undefined names
flake8 src tests --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings
flake8 src tests --count --exit-zero --max-complexity=10 --max-line-length=100 --statistics
continue-on-error: true

- name: Check formatting with black
run: |
black --check src tests --line-length=100
continue-on-error: true
50 changes: 50 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# Virtual environments
venv/
env/
ENV/
.venv

# IDEs
.vscode/
.idea/
*.swp
*.swo
*~

# Environment variables
.env
.env.local

# Testing
.pytest_cache/
.coverage
htmlcov/

# Logs
*.log

# OS
.DS_Store
Thumbs.db
Loading