mirror of
https://github.com/executeautomation/mcp-database-server.git
synced 2025-12-09 21:12:57 +08:00
code review
This commit is contained in:
@@ -74,7 +74,7 @@ export class MysqlAdapter implements DbAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
console.error(`[INFO] Generating AWS auth token for region: ${this.awsRegion}, host: ${this.host}, user: ${this.config.user}`);
|
console.info(`[INFO] Generating AWS auth token for region: ${this.awsRegion}, host: ${this.host}, user: ${this.config.user}`);
|
||||||
|
|
||||||
const signer = new Signer({
|
const signer = new Signer({
|
||||||
region: this.awsRegion,
|
region: this.awsRegion,
|
||||||
@@ -84,7 +84,7 @@ export class MysqlAdapter implements DbAdapter {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const token = await signer.getAuthToken();
|
const token = await signer.getAuthToken();
|
||||||
console.error(`[INFO] AWS auth token generated successfully`);
|
console.info(`[INFO] AWS auth token generated successfully`);
|
||||||
return token;
|
return token;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(`[ERROR] Failed to generate AWS auth token: ${(err as Error).message}`);
|
console.error(`[ERROR] Failed to generate AWS auth token: ${(err as Error).message}`);
|
||||||
@@ -97,11 +97,11 @@ export class MysqlAdapter implements DbAdapter {
|
|||||||
*/
|
*/
|
||||||
async init(): Promise<void> {
|
async init(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
console.error(`[INFO] Connecting to MySQL: ${this.host}, Database: ${this.database}`);
|
console.info(`[INFO] Connecting to MySQL: ${this.host}, Database: ${this.database}`);
|
||||||
|
|
||||||
// Handle AWS IAM authentication
|
// Handle AWS IAM authentication
|
||||||
if (this.awsIamAuth) {
|
if (this.awsIamAuth) {
|
||||||
console.error(`[INFO] Using AWS IAM authentication for user: ${this.config.user}`);
|
console.info(`[INFO] Using AWS IAM authentication for user: ${this.config.user}`);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const authToken = await this.generateAwsAuthToken();
|
const authToken = await this.generateAwsAuthToken();
|
||||||
@@ -121,7 +121,7 @@ export class MysqlAdapter implements DbAdapter {
|
|||||||
this.connection = await mysql.createConnection(this.config);
|
this.connection = await mysql.createConnection(this.config);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.error(`[INFO] MySQL connection established successfully`);
|
console.info(`[INFO] MySQL connection established successfully`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(`[ERROR] MySQL connection error: ${(err as Error).message}`);
|
console.error(`[ERROR] MySQL connection error: ${(err as Error).message}`);
|
||||||
if (this.awsIamAuth) {
|
if (this.awsIamAuth) {
|
||||||
|
|||||||
Reference in New Issue
Block a user