Documentation Index
Fetch the complete documentation index at: https://mintlify.com/marchena96/Paradigma-lab1/llms.txt
Use this file to discover all available pages before exploring further.
appsettings.json contains only the placeholder password [SUPABASE-PASSWORD] in the DefaultConnection string — the file is safe to commit and push to a public repository. The real connection string (with the actual Supabase password) is stored in .NET User Secrets, a local, per-developer secret store that lives outside the repository on your machine. User Secrets are loaded automatically by Host.CreateDefaultBuilder only when ASPNETCORE_ENVIRONMENT is set to Development, so the placeholder is never replaced in CI or production builds.
Why User Secrets?
.NET User Secrets implement the 12-factor app principle: configuration that differs between environments — especially credentials — should never live in source code. Keeping the password inappsettings.json would mean committing it to git, where it would be visible in the history forever even if you tried to remove it later.
With User Secrets:
- The repository contains only the placeholder, so it is safe to push to GitHub or hand to a reviewer.
- Each developer holds their own copy of the real password locally; a compromised machine does not expose the repository.
- Rotating the Supabase password requires updating only the local secret on each machine — no git commits needed.
Setup steps
Navigate to the project directory
All
dotnet user-secrets commands must run from (or target) the HackerRank1/ directory, because that is where HackerRank1.csproj — which carries the UserSecretsId — lives.Register the real connection string
Run the following command, substituting your actual Supabase password for The key name
<your-supabase-password>:ConnectionStrings:DefaultConnection uses : as a path separator — exactly what Configuration.GetConnectionString("DefaultConnection") resolves in Startup.cs.Verify the secret is registered
Confirm the secret was written correctly:You should see output similar to:
Where secrets are stored
User Secrets are stored in a JSON file outside the repository, in your operating system’s user profile directory. The location is determined by theUserSecretsId declared in HackerRank1/HackerRank1.csproj:
| OS | Path |
|---|---|
| Windows | %APPDATA%\Microsoft\UserSecrets\9cbbfeab-44b3-447c-8aa1-4d5adea68ef6\secrets.json |
| Linux / macOS | ~/.microsoft/usersecrets/9cbbfeab-44b3-447c-8aa1-4d5adea68ef6/secrets.json |
UserSecretsId GUID — .NET uses it to look up secrets for this specific project. The expected structure of secrets.json is:
%APPDATA% (or ~/.microsoft/), it is completely outside the cloned repository directory and will never be picked up by git.
Environment loading
User Secrets are only loaded whenASPNETCORE_ENVIRONMENT is set to Development. This value is pre-configured in Properties/launchSettings.json:
Program.cs:
CreateDefaultBuilder automatically appends the User Secrets configuration provider when it detects the Development environment, before Startup.ConfigureServices runs. The final configuration chain is:
| Source | Value for DefaultConnection |
|---|---|
appsettings.json | ...Password=[SUPABASE-PASSWORD]... (placeholder) |
| User Secrets | ...Password=<real>... ← wins, overrides placeholder |
| Environment variables | (not set) |
ASPNETCORE_ENVIRONMENT=Development. Use OS environment variables, Azure Key Vault, or another secrets manager to supply the connection string instead.
Onboarding checklist
Setting up a new machine
Setting up a new machine
Follow these steps whenever you clone the repository onto a new machine or set up a fresh development environment:
-
Clone the repository
-
Install the
dotnet-efglobal tool (required for migration commands) - Obtain PostgreSQL credentials Either request access to the existing Supabase project, or create a new Supabase project and note its host, username, and password from the Supabase dashboard under Settings → Database.
-
Register the connection string in User Secrets (from the
HackerRank1/directory) -
Build and run the API
The app starts at
https://localhost:7098. On first run,db.Database.Migrate()will automatically apply any pending EF Core migrations to your PostgreSQL database.
If you change machines or the local
secrets.json is lost, you can retrieve or reset the Supabase database password from the Supabase dashboard → Settings → Database → Reset database password. After resetting, re-run the dotnet user-secrets set command with the new password on every machine that runs the project.