一键导入
user-secrets-config
Manage `dotnet user-secrets` and environment variable overrides for local development and CI, including API keys and DB connection strings.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Manage `dotnet user-secrets` and environment variable overrides for local development and CI, including API keys and DB connection strings.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Stop and remove development Docker containers started by `docker-compose` to tear down local dependencies.
Start development dependency services with `docker-compose` (PostgreSQL, Keycloak, DAB) for local testing.
Launch the .NET Aspire orchestrator to start the full local application stack and its dependencies for development.
Publish .NET projects targeting linux-arm64 to produce ARM64-compatible container images (Apple Silicon).
Compile the BFF project to verify the `Microscope.Boilerplate.Clients.BFF` project builds successfully.
Publish .NET projects using the container publish profile to produce Docker images for services.
基于 SOC 职业分类
| apply | always |
| title | User Secrets & Configuration Management |
| category | Development Workflow |
| name | user-secrets-config |
| description | Manage `dotnet user-secrets` and environment variable overrides for local development and CI, including API keys and DB connection strings. |
Gestion sécurisée des secrets et configuration sensible en développement local avec dotnet user-secrets.
This skill helps developers securely manage sensitive configuration (API keys, connection strings, third‑party credentials) during local development using dotnet user-secrets, plus guidance for environment variable overrides and CI/CD integration.
cd src/templates/modular-monolith
dotnet user-secrets init
dotnet user-secrets set "AI:OpenAI:ApiKey" "sk-dev-xxxxx"
dotnet user-secrets set "ConnectionStrings:DefaultConnection" "Server=localhost;Port=5432;Database=mcsp_app;User Id=postgres;Password=devpassword"
builder.Configuration.AddUserSecrets<Program>();
var key = builder.Configuration["AI:OpenAI:ApiKey"];
services.Configure<OpenAiOptions>(builder.Configuration.GetSection("AI:OpenAI"));
Environment variables take precedence and are used for CI and containerized runs. Use AI__OpenAI__ApiKey style for nested keys.
export AI__OpenAI__ApiKey="sk-ci-override"
dotnet user-secrets set "AI:OpenAI:ApiKey" "sk-xxxxxxxx"
dotnet user-secrets list
public class OpenAiOptions { public string? ApiKey { get; set; } public string? Model { get; set; } }
services.Configure<OpenAiOptions>(configuration.GetSection("AI:OpenAI"));
ValidateOnStart).AddUserSecrets<T>() in development.dotnet user-secrets init executed for projectAI, ConnectionStrings, Auth)dotnet user-secrets CLIenv / shell for environment variableslocal-development - Bootstrapping local env and servicesef-core-migrations - Migrations often need DB connection stringsapi-testing - Uses secrets for authenticated requestsPro Tip: Use the Options pattern with ValidateOnStart() to fail fast if a critical secret is missing.