| 123456789101112131415161718192021222324252627282930313233343536373839 |
- import mysql from 'mysql2/promise';
- async function checkConfig() {
- const connection = await mysql.createConnection({
- host: '8.136.223.156',
- port: 6630,
- user: 'media_manager',
- password: 'media_manager',
- database: 'media_manager'
- });
- try {
- // 检查 system_config 表
- const [rows] = await connection.execute(
- 'SELECT * FROM system_config WHERE config_key = "python_publish_service_url"'
- );
-
- console.log('system_config 表中的 Python 服务配置:');
- console.log(rows);
- // 检查用户是否设置了配置
- if (rows.length === 0) {
- console.log('数据库中没有找到 python_publish_service_url 配置');
-
- // 插入默认配置
- await connection.execute(
- 'INSERT INTO system_config (config_key, config_value, description) VALUES (?, ?, ?)',
- ['python_publish_service_url', 'http://47.96.25.207:5005', 'Python 发布服务地址']
- );
- console.log('已插入默认配置: http://47.96.25.207:5005');
- }
- } catch (error) {
- console.error('数据库查询错误:', error.message);
- } finally {
- await connection.end();
- }
- }
- checkConfig();
|