mirror of
https://gitverse.ru/kpa39l/md2vk.git
synced 2026-09-29 09:55:04 +00:00
Baseline md2vk: docs, audit log, docker 8420, openspec, deploy
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
.PHONY: dev install run clean test
|
||||
|
||||
dev: install
|
||||
TOKEN_ENCRYPTION_KEY_FILE=secrets/token_encryption_key \
|
||||
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
|
||||
|
||||
install:
|
||||
python3 -m venv venv && \
|
||||
. venv/bin/activate && \
|
||||
pip install -r requirements.txt
|
||||
|
||||
run:
|
||||
TOKEN_ENCRYPTION_KEY_FILE=secrets/token_encryption_key \
|
||||
uvicorn app.main:app --host 0.0.0.0 --port 8000
|
||||
|
||||
test:
|
||||
. venv/bin/activate && \
|
||||
TOKEN_ENCRYPTION_KEY_FILE=secrets/token_encryption_key \
|
||||
python3 -m pytest tests/ -v
|
||||
|
||||
clean:
|
||||
rm -rf venv/ __pycache__ .pytest_cache
|
||||
find . -name '*.pyc' -delete
|
||||
|
||||
docker-build:
|
||||
docker compose build
|
||||
|
||||
docker-up:
|
||||
docker compose up -d
|
||||
|
||||
docker-down:
|
||||
docker compose down
|
||||
|
||||
key:
|
||||
python3 -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"
|
||||
|
||||
user:
|
||||
TOKEN_ENCRYPTION_KEY_FILE=secrets/token_encryption_key \
|
||||
python3 -c "
|
||||
import asyncio
|
||||
from app.database import init_db, async_session_factory
|
||||
from app.models import User
|
||||
from app.security import generate_api_key
|
||||
async def create():
|
||||
await init_db()
|
||||
async with async_session_factory() as session:
|
||||
key, h = generate_api_key()
|
||||
u = User(api_key_hash=h, display_name='admin')
|
||||
session.add(u)
|
||||
await session.commit()
|
||||
print(f'User created. API key: {key}')
|
||||
asyncio.run(create())
|
||||
"
|
||||
Reference in New Issue
Block a user