Google Cloud SQL 的典型 ormconfig.json 文件?

2023-12-27

我已经尝试了几个小时了。 Google Cloud SQL 与 TypeORM 配合使用的 ormconfig.json 文件应该是什么?我设法让它在本地使用数据库的IP(使用mysql工作台和Google云代理并将我的IP列入白名单),但我不知道应用程序引擎的连接详细信息应该是什么。

{
  "name": "default",
  "type": "mysql",
  "host": "/cloudsql/[project:region:instance]",
  "port": "3306",
  "username": "root",
  "password": "xxxx",
  "database": "yyy",
  "synchronize": true,
  "logging": false,
  "entities": [
    "modules/**/*.entity.js"
  ]
}

or

{
  "name": "default",
  "type": "mysql",
  "extra": {
    "socketPath": "/cloudsql/[project:region:instance]"
  },
  "username": "root",
  "password": "xxxx",
  "database": "yyy",
  "synchronize": true,
  "logging": false,
  "entities": [
    "modules/**/*.entity.js"
  ]
}

或者其他什么?

多谢!


对于那些有兴趣的人,这里是解决方案:

{
  "name": "default",
  "type": "mysql",
  "extra": {
    "socketPath": "/cloudsql/[project:region:instance]"
  },
  "username": "root",
  "password": "xxxx",
  "database": "yyy",
  "synchronize": true,
  "logging": false,
  "entities": [
    "dist/**/*.entity.js"
  ]
}

请注意,我还更改了entities path

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Google Cloud SQL 的典型 ormconfig.json 文件? 的相关文章

随机推荐