index.ts 731 B

1234567891011121314151617181920212223242526272829
  1. import { Sequelize } from 'sequelize-typescript'
  2. import * as Models from './models'
  3. import { RPC } from '../utils/EVMHelper/dbModels'
  4. import { DB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASS } from '../constants'
  5. // import { promisify } from 'util'
  6. const { Constant, Application, Tweet, Score, Art } = Models
  7. const sequelize = new Sequelize({
  8. host: DB_HOST,
  9. port: DB_PORT ? Number.parseInt(DB_PORT) : 3306,
  10. database: DB_NAME,
  11. dialect: 'mariadb',
  12. username: DB_USER,
  13. password: DB_PASS,
  14. dialectOptions: {
  15. timezone: '+00:00',
  16. allowPublicKeyRetrieval: true,
  17. },
  18. logging: false,
  19. pool: {
  20. max: 25,
  21. },
  22. models: [Constant, RPC, Application, Tweet, Score, Art],
  23. })
  24. export default sequelize
  25. export { Models }