ec4c8fab87
Move configuration options from Core/DataAccess/DataSync/ExcelIO to dedicated Options folders within each project for better organization. Update all references and tests accordingly.
117 lines
4.2 KiB
Markdown
117 lines
4.2 KiB
Markdown
# Options Classes Relocation Design
|
|
|
|
## Summary
|
|
|
|
Move options classes from Core project to the projects that use them, establishing an `Options/` folder convention across all projects.
|
|
|
|
## Current State
|
|
|
|
All 7 options classes live in `JdeScoping.Core/Options/`:
|
|
- `AuthOptions` - used by Api + Infrastructure
|
|
- `DataSourceOptions` - used by Infrastructure
|
|
- `DataSyncOptions` - duplicate (real one in DataSync)
|
|
- `ExcelExportOptions` - duplicate (real one in ExcelIO)
|
|
- `LdapOptions` - used by Infrastructure
|
|
- `SearchOptions` - unused (future use in DataAccess)
|
|
- `SearchProcessingOptions` - used by DataAccess
|
|
|
|
## Target State
|
|
|
|
### Folder Structure
|
|
|
|
```
|
|
src/
|
|
├── JdeScoping.Api/
|
|
│ └── Options/
|
|
│ └── AuthOptions.cs
|
|
├── JdeScoping.DataAccess/
|
|
│ └── Options/
|
|
│ ├── SearchOptions.cs
|
|
│ └── SearchProcessingOptions.cs
|
|
├── JdeScoping.Infrastructure/
|
|
│ └── Options/
|
|
│ ├── DataSourceOptions.cs
|
|
│ └── LdapOptions.cs
|
|
├── JdeScoping.DataSync/
|
|
│ └── Options/ # Renamed from Configuration/
|
|
│ └── DataSyncOptions.cs
|
|
├── JdeScoping.ExcelIO/
|
|
│ └── Options/ # Renamed from Configuration/
|
|
│ └── ExcelExportOptions.cs
|
|
└── JdeScoping.Core/
|
|
└── (Options folder deleted)
|
|
```
|
|
|
|
### Property Moves
|
|
|
|
**LdapOptions** gains properties from AuthOptions:
|
|
- `UseFakeAuth` (bool, default: false)
|
|
- `AdminBypassUsers` (string[], default: [])
|
|
|
|
**AuthOptions** loses those properties, keeping only:
|
|
- `CookieName` (string, default: "ScopingTool.Auth")
|
|
- `CookieExpirationMinutes` (int, default: 480)
|
|
|
|
### Namespace Changes
|
|
|
|
| Old Namespace | New Namespace |
|
|
|---------------|---------------|
|
|
| `JdeScoping.Core.Options.AuthOptions` | `JdeScoping.Api.Options.AuthOptions` |
|
|
| `JdeScoping.Core.Options.SearchOptions` | `JdeScoping.DataAccess.Options.SearchOptions` |
|
|
| `JdeScoping.Core.Options.SearchProcessingOptions` | `JdeScoping.DataAccess.Options.SearchProcessingOptions` |
|
|
| `JdeScoping.Core.Options.DataSourceOptions` | `JdeScoping.Infrastructure.Options.DataSourceOptions` |
|
|
| `JdeScoping.Core.Options.LdapOptions` | `JdeScoping.Infrastructure.Options.LdapOptions` |
|
|
| `JdeScoping.DataSync.Configuration.*` | `JdeScoping.DataSync.Options.*` |
|
|
| `JdeScoping.ExcelIO.Configuration.*` | `JdeScoping.ExcelIO.Options.*` |
|
|
|
|
### DI Registration Changes
|
|
|
|
**Infrastructure/DependencyInjection.cs:**
|
|
- Remove `AuthOptions` registration
|
|
- Change `authOptions?.UseFakeAuth` check to use `ldapOptions?.UseFakeAuth`
|
|
|
|
**Api/DependencyInjection.cs:**
|
|
- Add `AuthOptions` registration
|
|
|
|
### Configuration (appsettings.json)
|
|
|
|
Move settings from `"Auth"` to `"Ldap"` section:
|
|
```json
|
|
{
|
|
"Ldap": {
|
|
"ServerUrls": ["ldap.corp.example.com"],
|
|
"GroupDn": "CN=ScopingTool-Users,OU=Groups,DC=corp,DC=example,DC=com",
|
|
"SearchBase": "DC=corp,DC=example,DC=com",
|
|
"ConnectionTimeoutSeconds": 30,
|
|
"UseFakeAuth": false,
|
|
"AdminBypassUsers": []
|
|
},
|
|
"Auth": {
|
|
"CookieName": "ScopingTool.Auth",
|
|
"CookieExpirationMinutes": 480
|
|
}
|
|
}
|
|
```
|
|
|
|
## Files to Delete
|
|
|
|
- `src/JdeScoping.Core/Options/AuthOptions.cs`
|
|
- `src/JdeScoping.Core/Options/DataSourceOptions.cs`
|
|
- `src/JdeScoping.Core/Options/DataSyncOptions.cs`
|
|
- `src/JdeScoping.Core/Options/ExcelExportOptions.cs`
|
|
- `src/JdeScoping.Core/Options/LdapOptions.cs`
|
|
- `src/JdeScoping.Core/Options/SearchOptions.cs`
|
|
- `src/JdeScoping.Core/Options/SearchProcessingOptions.cs`
|
|
- `src/JdeScoping.Core/Options/` (folder)
|
|
|
|
## Files to Update
|
|
|
|
- `Host/Program.cs` - update using statements
|
|
- `Infrastructure/DependencyInjection.cs` - remove AuthOptions, use LdapOptions for UseFakeAuth
|
|
- `Infrastructure/Auth/LdapAuthService.cs` - update using, use LdapOptions for AdminBypassUsers
|
|
- `Api/DependencyInjection.cs` - add AuthOptions registration
|
|
- `DataAccess/DependencyInjection.cs` - update using statements
|
|
- `DataSync/**` - rename Configuration namespace to Options
|
|
- `ExcelIO/**` - rename Configuration namespace to Options
|
|
- `appsettings.json` - move UseFakeAuth/AdminBypassUsers to Ldap section
|