/ Database

【 DB 】啟用 sequelize SSL

內容

  • 學習目標
  • 前置準備作業
  • SSL connection 問題
  • 解決方法

學習目標

  • 啟用 sequelizeSSL 功能

前置準備作業

  • 已建立資料庫
  • 已安裝 Node.jsSequelize

SSL connection 問題

當執行 npx sequelize db:migrate 出現下方錯誤訊息

---2020-04-01---11.26.24


解決方法

Step 1. 修改 config.json 設定檔

  • 開啟 configconfig.json

    "development": {
        "username": "",
        "password": "",
        "database": "",
        "host": "",
        "dialect": "postgres",
        "operatorsAliases": false
      }
    
  • 新增下方 SSL 設定到 operatorsAliases 之後

        ,
        "ssl": true,
        "dialectOptions": {
          "ssl": {
            "require": true
          }
        }
    
  • 修改後的 config.json

    "development": {
        "username": "",
        "password": "",
        "database": "",
        "host": "",
        "dialect": "",
        "operatorsAliases": false,
        "ssl": true,
        "dialectOptions": {
          "ssl": {
            "require": true
          }
        }
    },
    

Step 2. 重新執行 migrate

---2020-04-01---11.27.53


GitHub
List of blogs
Archer

Archer

Having being a software engineer. Experience with Python, JavaScript, Node.js, Objective-C, Micro:bit, Raspberry Pi, AWS, Azure, IoT. ❆ [email protected] https://oranwind.org/author/archer/

Read More