knexfile.js 863 B

123456789101112131415161718192021222324252627282930
  1. // this configuration is for migrations only
  2. // and since jwt secret is not required, it's set to a placehodler string to bypass env validation
  3. if (process.env.NODE_ENV !== "development" && process.env.NODE_ENV !== "production") {
  4. if (!process.env.JWT_SECRET) {
  5. process.env.JWT_SECRET = "securekey";
  6. }
  7. }
  8. const env = require("./server/env");
  9. const isSQLite = env.DB_CLIENT === "sqlite3" || env.DB_CLIENT === "better-sqlite3";
  10. module.exports = {
  11. client: env.DB_CLIENT,
  12. connection: {
  13. ...(isSQLite && { filename: env.DB_FILENAME }),
  14. host: env.DB_HOST,
  15. database: env.DB_NAME,
  16. user: env.DB_USER,
  17. port: env.DB_PORT,
  18. password: env.DB_PASSWORD,
  19. ssl: env.DB_SSL,
  20. },
  21. useNullAsDefault: true,
  22. migrations: {
  23. tableName: "knex_migrations",
  24. directory: "server/migrations",
  25. disableMigrationsListValidation: true,
  26. }
  27. };