database.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /**
  2. * Config source: https://git.io/JesV9
  3. *
  4. * Feel free to let us know via PR, if you find something broken in this config
  5. * file.
  6. */
  7. import Env from '@ioc:Adonis/Core/Env'
  8. import type { DatabaseConfig } from '@ioc:Adonis/Lucid/Database'
  9. console.log(Env.get('MYSQL_HOST'))
  10. const databaseConfig: DatabaseConfig = {
  11. /*
  12. |--------------------------------------------------------------------------
  13. | Connection
  14. |--------------------------------------------------------------------------
  15. |
  16. | The primary connection for making database queries across the application
  17. | You can use any key from the `connections` object defined in this same
  18. | file.
  19. |
  20. */
  21. connection: Env.get('DB_CONNECTION'),
  22. connections: {
  23. /*
  24. |--------------------------------------------------------------------------
  25. | MySQL config
  26. |--------------------------------------------------------------------------
  27. |
  28. | Configuration for MySQL database. Make sure to install the driver
  29. | from npm when using this connection
  30. |
  31. | npm i mysql2
  32. |
  33. */
  34. mysql: {
  35. client: 'mysql2',
  36. connection: {
  37. host: Env.get('MYSQL_HOST'),
  38. port: Env.get('MYSQL_PORT'),
  39. user: Env.get('MYSQL_USER'),
  40. password: Env.get('MYSQL_PASSWORD', ''),
  41. database: Env.get('MYSQL_DB_NAME')
  42. },
  43. migrations: {
  44. naturalSort: true
  45. },
  46. healthCheck: false,
  47. debug: true
  48. }
  49. }
  50. }
  51. export default databaseConfig