FoalTS / foal

Full-featured Node.js framework, with no complexity. 🚀 Simple and easy to use, TypeScript-based and well-documented.
https://foalts.org/
MIT License
1.88k stars 137 forks source link

MySQL - SSL Certificate (CA) path in json settings #981

Closed lcnvdl closed 2 years ago

lcnvdl commented 2 years ago

Hello!

I'm trying to configure my Azure Mysql Database. I couldn't find on internet 8and in the official Foal.ts website) how to configure the SSL CA Path of my database. My current configuration is:

  "database": {
    "type": "mysql",
    "host": "mydatabase.mysql.database.azure.com",
    "port": 3306,
    "username": "myuser",
    "password": "mypassword",
    "database": "mydatabase"
  }

How can I add my CA Cert path to the config . json?

Thanks in advance

lcnvdl commented 2 years ago

When I try to specify the cert file I got an error:

  "database": {
    "type": "mysql",
    "host": "mydatabase.mysql.database.azure.com",
    "port": 3306,
    "username": "myuser",
    "password": "mypassword",
    "database": "mydatabase",
    "ssl": {
        "C:\\sql\\DigiCertGlobalRootCA.crt.pem"
    }
  }

Command:

npm run makemigrations

Error message:

Error during migration generation:
Error: ER_SECURE_TRANSPORT_REQUIRED: Connections using insecure transport are prohibited while --require_secure_transport=ON.
kingdun3284 commented 2 years ago

This is not an foalts issue. Try to find the document of the orm you are using. By default, it should be typeORM.

lcnvdl commented 2 years ago

Hello. Then, How can I configure the SSL certificates using the Foalts Json configuration?

kingdun3284 commented 2 years ago

Import config from foalts in your orm.config.js

lcnvdl commented 2 years ago

Import config from foalts in your orm.config.js

Thank you very much! Now I understand how it works. I think that I can solve the problem with that information.

Best regards, LR