Set console title based on DB environment (DEV/PROD)

Added SetConsoleTitleFromCatalog to detect the database environment from the connection string and set the console window title to [PROD] or [DEV] accordingly. Throws on ambiguous catalog names and prints a red warning for production. Switched appsettings.json to use the DEV database. Added Microsoft.Data.SqlClient for connection string parsing. This reduces risk of accidental operations on the wrong database.
This commit is contained in:
Loretta 2026-07-12 08:36:14 +02:00
parent 52f19979af
commit eed95f193d
1 changed files with 1 additions and 1 deletions

View File

@ -1,6 +1,6 @@
{
"ConnectionStrings": {
"ConnectionString": "Data Source=100.73.220.50;Initial Catalog=FruitBank_PROD;Integrated Security=False;Persist Security Info=False;User ID=sa;Password=v6f_?xNfg9N1;Trust Server Certificate=True",
"ConnectionString": "Data Source=100.73.220.50;Initial Catalog=FruitBank_DEV;Integrated Security=False;Persist Security Info=False;User ID=sa;Password=v6f_?xNfg9N1;Trust Server Certificate=True",
"DataProvider": "sqlserver",
"SQLCommandTimeout": null,
"WithNoLock": false