Skip to content
Open
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
6 changes: 4 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
__pycache__/
*.pyc
venv/
.env
.venv/
.git
.gitignore
*.db
.DS_Store
46 changes: 5 additions & 41 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,41 +1,5 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# env files (can opt-in for committing if needed)
.env*

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
*.md
!README.md
__pycache__/
*.pyc
*.db
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM python:3.13-slim

WORKDIR /app

COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

COPY server.py ./
COPY modules ./modules
COPY static ./static

EXPOSE 9191

CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "9191"]
23 changes: 0 additions & 23 deletions components.json

This file was deleted.

21 changes: 14 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
version: "3.9"
services:
frontend:
build:
context: .
dockerfile: ./docker/frontend.Dockerfile
charlendar:
build: .
ports:
- "3000:3000" # use 3000:3000 if 3000 is free
- "9191:9191"
environment:
NODE_ENV: production
SQLITE_FILE: /data/charlendar.db
ROOT_PATH: ${ROOT_PATH:-/bookings}
HMAC_SECRET: ${HMAC_SECRET:-dev-secret-change-me}
ADMIN_API_KEY: ${ADMIN_API_KEY:-dev-admin-key-change-me}
BOOKING_DURATION_MINUTES: ${BOOKING_DURATION_MINUTES:-60}
volumes:
- charlendar-data:/data
restart: unless-stopped

volumes:
charlendar-data:
13 changes: 0 additions & 13 deletions docker/frontend.Dockerfile

This file was deleted.

18 changes: 0 additions & 18 deletions eslint.config.mjs

This file was deleted.

6 changes: 0 additions & 6 deletions lib/utils.ts

This file was deleted.

14 changes: 14 additions & 0 deletions modules/admin_key.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import hmac

from fastapi import Header, HTTPException, status

from modules.constants import ADMIN_API_KEY


def require_admin_key(x_admin_key: str | None = Header(default=None)) -> None:
if not x_admin_key or not hmac.compare_digest(x_admin_key, ADMIN_API_KEY):
raise HTTPException(status.HTTP_403_FORBIDDEN, "Invalid or missing admin key")


def is_admin_key(x_admin_key: str | None) -> bool:
return bool(x_admin_key) and hmac.compare_digest(x_admin_key, ADMIN_API_KEY)
9 changes: 9 additions & 0 deletions modules/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import os

SQLITE_FILE = os.environ.get("SQLITE_FILE", "charlendar.db")
ROOT_PATH = os.environ.get("ROOT_PATH", "/bookings")
HMAC_SECRET = os.environ.get("HMAC_SECRET", "dev-secret-change-me")
ADMIN_API_KEY = os.environ.get("ADMIN_API_KEY", "dev-admin-key-change-me")

EVENT_NAME = "SCE Internship Interview"
BOOKING_DURATION_MINUTES = int(os.environ.get("BOOKING_DURATION_MINUTES", "60"))
Loading