fengling-console/docs/task-12-create-console-project.md

102 lines
3.1 KiB
Markdown

# Task 12: Create Fengling.Console Project Structure
## Task Description
**Files:**
- Create: `src/Fengling.Console/Fengling.Console.csproj`
- Create: `src/Fengling.Console/Program.cs`
- Create: `src/Fengling.Console/appsettings.json`
## Implementation Steps
### Step 1: Create project
Run:
```bash
cd /Users/movingsam/Fengling.Refactory.Buiding/src
dotnet new webapi -n Fengling.Console -o Fengling.Console
```
### Step 2: Update project file with dependencies
Edit: `src/Fengling.Console/Fengling.Console.csproj`
```xml
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="8.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.0" />
<PackageReference Include="Serilog.AspNetCore" Version="9.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="OpenTelemetry" Version="1.11.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.11.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.11.0" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.11.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="10.0.2" />
</ItemGroup>
</Project>
```
### Step 3: Create appsettings.json
Edit: `src/Fengling.Console/appsettings.json`
```json
{
"ConnectionStrings": {
"DefaultConnection": "Host=192.168.100.10;Port=5432;Database=fengling_gateway;Username=movingsam;Password=sl52788542"
},
"AuthService": {
"BaseUrl": "http://auth.fengling.local",
"ClientId": "fengling-console",
"ClientSecret": "console-secret-change-in-production"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}
```
### Step 4: Commit
```bash
git add src/Fengling.Console/
git commit -m "feat(console): create console backend project structure"
```
## Context
This task creates the Fengling.Console backend project. This will be a unified management API that includes gateway management, OAuth client management, and user management proxy.
**Tech Stack**: .NET 10.0, EF Core 10.0, PostgreSQL, Serilog, OpenTelemetry
## Verification
- [ ] Project created with webapi template
- [ ] Target framework set to net10.0
- [ ] All packages added
- [ ] appsettings.json configured
- [ ] Build succeeds
- [ ] Committed to git
## Notes
- Shares database with YarpGateway
- Communicates with AuthService via OAuth2
- Will contain migrated gateway management APIs