Light Go + Gin backend that:
- authenticates via unique password hash
- lists uploaded archives
- uploads compressed log archives
- downloads compressed log archives by id
Storage is SQLite.
Create .env in project root:
AUTH_PASSWORD_HASH='$2a$10$REPLACE_WITH_BCRYPT_HASH'
JWT_SECRET='replace-with-a-strong-secret'
JWT_TTL_SECONDS=3600Notes:
AUTH_PASSWORD_HASHmust be bcrypt hash (not plain text).
go run .Server: http://127.0.0.1:8080
docker build -t cloud-logs:latest .
docker compose up -dStop:
docker compose downBase URL: http://<host>:8080
Body:
{"password":"test"}Example:
curl -i -X POST http://127.0.0.1:8080/auth/login \
-H "Content-Type: application/json" \
-d '{"password":"test"}'Tip to store token:
TOKEN=$(curl -s -X POST http://127.0.0.1:8080/auth/login \
-H "Content-Type: application/json" \
-d '{"password":"test"}' | sed -n 's/.*"access_token":"\([^"]*\)".*/\1/p')Multipart upload, field name: file.
Example:
curl -i -X POST http://127.0.0.1:8080/logs/upload \
-H "Authorization: Bearer $TOKEN" \
-F "file=@logs.zip"Returns metadata list (id, filename, content_type, size_bytes).
Example:
curl -i http://127.0.0.1:8080/logs/list \
-H "Authorization: Bearer $TOKEN"Downloads archive binary by id.
Example:
curl -OJ http://127.0.0.1:8080/logs/download/1 \
-H "Authorization: Bearer $TOKEN"