Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
417 views
in Technique[技术] by (71.8m points)

json - How to configure a new environment for sequelize

So I'm remaking some of the backend code of my company (from Java) in NodeJS. One of the things I'm focusing on is using technologies and libraries similar to what is already being used to ease my colleagues transition to the new code. Since they use Hibernate, I plan on using Sequelize ORM.

The thing is, Sequelize comes by default configured for the 3 main environment options for NodeJS, development, test and production. Here at my company we have a fourth environment which is "homol"(homologation) which is an environment where some user can test the final product before it goes into production.

How can I add and configure my project to include this fourth environment? I do realize I can just add a new parameter inside the config.json file, but how do I configure the entire Sequelize package to target that specific environment?

{
  "development": {
    "username": "postgres",
    "password": "postgres",
    "database": "postgres",
    "host": "127.0.0.1",
    "dialect": "postgres",
    "operatorsAliases": false
  },
  "homol": { //How to configure Sequelize to target this new environment
    "username": "postgres",
    "password": "postgres",
    "database": "postgres",
    "host": "127.0.0.1",
    "dialect": "postgres",
    "operatorsAliases": false
  },
  "test": {
    "username": "postgres",
    "password": "postgres",
    "database": "postgres",
    "host": "127.0.0.1",
    "dialect": "postgres",
    "operatorsAliases": false
  },
  "production": {
    "username": "postgres",
    "password": "postgres",
    "database": "postgres",
    "host": "127.0.0.1",
    "dialect": "postgres",
    "operatorsAliases": false
  }
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...