revert: remove .env loading, restore hardcoded config

- appsettings.json: restored hardcoded secrets
- Program.cs: removed .env file loader
- Frontend api-clients: restored hardcoded localhost:5000
- Removed .env, .env.example, vite-env.d.ts files
- Kept all audit fixes (endpoints, DTOs, field names, status labels)
This commit is contained in:
MingNian
2026-05-24 13:38:45 +08:00
parent ede4a8d29e
commit db443b258e
14 changed files with 93 additions and 155 deletions

View File

@@ -1,15 +0,0 @@
# PostgreSQL
ConnectionStrings__Default=Host=localhost;Port=5432;Database=health_manager;Username=postgres;Password=your_password
# JWT
Jwt__Secret=your-jwt-secret-change-me
Jwt__Issuer=HealthManager
Jwt__Audience=HealthManagerApp
# Redis (reserved)
Redis__Connection=localhost:6379
# MinIO (reserved)
MinIO__Endpoint=localhost:9000
MinIO__AccessKey=minioadmin
MinIO__SecretKey=minioadmin

View File

@@ -5,6 +5,7 @@ using HealthManager.Application.Services;
using HealthManager.Domain.Entities;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace HealthManager.WebApi.Controllers;

View File

@@ -71,7 +71,6 @@ public class MedicationController(MedicationService medicationService) : Control
var rate = await medicationService.GetAdherenceRateAsync(id);
return Ok(new { medicationId = id, rate });
}
}
[HttpPut("{id:guid}")]
public async Task<IActionResult> UpdateMedication(Guid id, [FromBody] MedicationUpdateRequest request)

View File

@@ -9,24 +9,6 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.IdentityModel.Tokens;
using Swashbuckle.AspNetCore.SwaggerGen;
// Load .env file into environment variables
var envPath = Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", ".env");
if (File.Exists(envPath))
{
foreach (var line in File.ReadAllLines(envPath))
{
var trimmed = line.Trim();
if (string.IsNullOrEmpty(trimmed) || trimmed.StartsWith('#')) continue;
var eq = trimmed.IndexOf('=');
if (eq > 0)
{
var key = trimmed[..eq].Trim();
var value = trimmed[(eq + 1)..].Trim();
Environment.SetEnvironmentVariable(key, value);
}
}
}
var builder = WebApplication.CreateBuilder(args);
// Database

View File

@@ -7,19 +7,19 @@
},
"AllowedHosts": "*",
"ConnectionStrings": {
"Default": ""
"Default": "Host=localhost;Port=5432;Database=health_manager;Username=postgres;Password=postgres123"
},
"Jwt": {
"Secret": "",
"Secret": "health-manager-jwt-secret-key-2026-super-secure-long-enough!",
"Issuer": "HealthManager",
"Audience": "HealthManagerApp"
},
"Redis": {
"Connection": ""
"Connection": "localhost:6379"
},
"MinIO": {
"Endpoint": "",
"AccessKey": "",
"SecretKey": ""
"Endpoint": "localhost:9000",
"AccessKey": "minioadmin",
"SecretKey": "minioadmin"
}
}