vbytes-lan-registration/README.md
2026-02-19 10:54:32 +01:00

114 lines
4.1 KiB
Markdown

# vbytes-lan-registration
Micro Service For Registering For An Event
## TECH STACK
### FrontEnd
- React
- ShadCN
### BackEnd
- .NET API Controllers
- Dapper
#### Design
- GET Is Already Registered -- Local Database
- GET Is Member -- Auth API
- POST Register Member For Event -- Main Database
### Database
- Postgres
## Configuration
Sensitive values are never stored in source control. Configure them via [user secrets](https://learn.microsoft.com/en-us/aspnet/core/security/app-secrets) (development) or environment variables (production).
Key-only examples are available here:
- `src/Registration/Registration.API/appsettings.example.json`
- `src/Auth/AuthAPI/appsettings.example.json`
- `src/Web/lan-frontend/.env.example`
### Frontend (Next.js)
Run from `src/Web/lan-frontend`:
```bash
cp .env.example .env.local
```
Set the backend API base URL in `.env.local`:
```env
REGISTRATION_API_URL=http://localhost:5063
```
### Registration.API
Run from `src/Registration/Registration.API`:
```bash
dotnet user-secrets set "VbytesRelay:ApiKey" "<your-api-key>"
dotnet user-secrets set "VbytesRelay:ClientCertificatePfxPath" "<absolute-path-to>.pfx"
dotnet user-secrets set "VbytesRelay:ParticipantRegisterPath" "/api/participant"
dotnet user-secrets set "Security:SsnPepper" "<your-pepper-value>"
```
| Key | Description |
| -------------------------------------- | ------------------------------------------------------------------------------------- |
| `VbytesRelay:ApiKey` | API key for the Vbytes relay service |
| `VbytesRelay:ClientCertificatePfxPath` | Absolute path to the client certificate `.pfx` file |
| `VbytesRelay:ParticipantRegisterPath` | Path for the participant registration endpoint on the relay (e.g. `/api/participant`) |
| `Security:SsnPepper` | Pepper value used when hashing SSNs |
For non-development environments, ensure these environment variables are set:
```bash
ConnectionStrings__DefaultConnection=<postgres-connection-string>
Security__SsnPepper=<pepper-value>
VbytesRelay__BaseUrl=https://api.lan.vbytes.se
VbytesRelay__ParticipantRegisterPath=/api/participant
VbytesRelay__VolunteerRegisterPath=/api/volunteer
VbytesRelay__ApiKeyHeaderName=X-Api-Key
VbytesRelay__ApiKey=<relay-api-key>
VbytesRelay__ClientCertificatePfxPath=<absolute-path-to>.pfx
AuthApi__BaseUrl=<auth-api-base-url>
AuthApi__ValidatePath=/validate
```
> **Note:** ASP.NET Core's configuration priority is `appsettings.json` → `appsettings.Development.json` → **user secrets** → **environment variables**. Environment variables always win, so any value set in `launchSettings.json` will override user secrets. Secret values (`ApiKey`, cert paths, relay paths) are intentionally absent from `launchSettings.json` to ensure user secrets are respected.
### AuthAPI
Run from `src/Auth/AuthAPI`:
```bash
dotnet user-secrets set "EnvironmentVariables:ApiUrl" "<member-api-url>"
dotnet user-secrets set "EnvironmentVariables:ApiKey" "<member-api-key>"
dotnet user-secrets set "EnvironmentVariables:AssociationNumber" "<association-number>"
```
| Key | Description |
| ---------------------------------------- | ------------------------------------------ |
| `EnvironmentVariables:ApiUrl` | Base URL of the member validation API |
| `EnvironmentVariables:ApiKey` | API key for the member validation API |
| `EnvironmentVariables:AssociationNumber` | Association number used for member lookups |
For non-development environments, ensure these environment variables are set:
```bash
EnvironmentVariables__ApiUrl=<member-api-url>
EnvironmentVariables__ApiKey=<member-api-key>
EnvironmentVariables__AssociationNumber=<association-number>
```
For frontend production configuration, set:
```bash
REGISTRATION_API_URL=<registration-api-base-url>
```