Initial commit

This commit is contained in:
2026-01-04 23:00:21 +08:00
commit d3178871eb
124 changed files with 19300 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
# License System Backend
ASP.NET Core 8 API service for the software authorization system.
## Requirements
- .NET 8 SDK
- PostgreSQL 16+
- Redis 7+ (optional, for rate limiting)
## Quick Start
1. Create database and apply schema:
```bash
psql -U postgres -d license -f scripts/init.sql
```
2. Update `src/License.Api/appsettings.json` with your connection string and JWT secret.
3. Run the API:
```bash
dotnet restore
ASPNETCORE_URLS=http://localhost:39256 dotnet run --project src/License.Api
```
4. Swagger:
```
http://localhost:39256/swagger
```
## Docker Compose
1. Copy env file:
```bash
cp .env.example .env
```
2. Start services:
```bash
docker compose up -d
```
3. Check health:
```bash
curl http://localhost:39256/health/ready
```
## Notes
- On first run, a `super_admin` user is seeded from `Seed` config in `appsettings.json`.
- Files are stored under the `Storage:UploadRoot` path (defaults to `uploads/`).
- If `Storage:ClientRsaPublicKeyPem` is empty, files are stored unencrypted and no key headers are returned.
- CORS can be restricted via `Cors:AllowedOrigins` or env `Cors__AllowedOrigins__0` (set `Cors:AllowAny` to `true` for dev).
- When `Storage:RequireHttpsForDownloadKey` is `true`, encrypted downloads require HTTPS to return the decryption key.
- Auth signature accepts `ProjectSecret` or `ProjectKey` (use ProjectKey for client integrations).