Centralize credentials and make migration idempotent

- Move all DB credentials to config.asp with DSN/ODBC toggle
- Add Zabbix API URL and token to centralized config
- Update sql.asp, api.asp, apiusb.asp, zabbix.asp to use config
- Add GetConnectionString() and GetEmployeeConnectionString() functions
- Make migration SQL idempotent (safe to run multiple times)
- Add duplicate index cleanup (appname_2) to migration
- Document employee DB access limitation in CLAUDE.md

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
cproudlock
2025-12-12 08:11:28 -05:00
parent e0d89f9957
commit 131aaaddbf
9 changed files with 150 additions and 77 deletions

View File

@@ -1,30 +1,25 @@
<%@ Language="VBScript" %>
<%
Option Explicit
%>
<!--#include file="includes/config.asp"-->
<%
'=============================================================================
' FILE: apiusb.asp
' PURPOSE: API endpoints for USB device operations
' SECURITY: Parameterized queries, JSON output
' CREATED: 2025-12-07
'=============================================================================
Option Explicit
Response.ContentType = "application/json"
Response.Charset = "utf-8"
Response.Buffer = True
' Create database connection directly (avoid sql.asp scoping issues)
Dim objConn, DB_CONN_STRING
DB_CONN_STRING = "Driver={MySQL ODBC 9.4 Unicode Driver};" & _
"Server=192.168.122.1;" & _
"Port=3306;" & _
"Database=shopdb;" & _
"User=570005354;" & _
"Password=570005354;" & _
"Option=3;" & _
"Pooling=True;Max Pool Size=100;"
' Database connection using centralized config
Dim objConn
On Error Resume Next
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = DB_CONN_STRING
objConn.ConnectionString = GetConnectionString()
objConn.Open
If Err.Number <> 0 Then