chore: db file compatibility (#228)
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
const databasePath = path.resolve(__dirname, '../../database/database.sqlite');
|
const databasePath = path.resolve(__dirname, '../database/database.sqlite');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
development: {
|
development: {
|
||||||
@@ -14,5 +14,5 @@ module.exports = {
|
|||||||
production: {
|
production: {
|
||||||
dialect: 'sqlite',
|
dialect: 'sqlite',
|
||||||
storage: databasePath,
|
storage: databasePath,
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,9 +1,18 @@
|
|||||||
|
const path = require('path');
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const RateLimit = require('express-rate-limit');
|
const RateLimit = require('express-rate-limit');
|
||||||
const path = require('path');
|
|
||||||
const { Sequelize } = require('sequelize');
|
const { Sequelize } = require('sequelize');
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
|
// enable frontend access
|
||||||
|
const cors = require('cors');
|
||||||
|
const frontendOrigin = process.env.FRONTEND_ORIGIN || 'http://localhost:8000';
|
||||||
|
const corsOptions = {
|
||||||
|
origin: frontendOrigin,
|
||||||
|
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
|
||||||
|
};
|
||||||
|
app.use(cors(corsOptions));
|
||||||
|
|
||||||
// enable json middleware
|
// enable json middleware
|
||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
|
|
||||||
@@ -19,9 +28,10 @@ app.use(limiter);
|
|||||||
app.use(express.static(path.join(__dirname, 'public')));
|
app.use(express.static(path.join(__dirname, 'public')));
|
||||||
|
|
||||||
// init sequalize
|
// init sequalize
|
||||||
|
const databasePath = path.resolve(__dirname, 'database/database.sqlite');
|
||||||
const sequelize = new Sequelize({
|
const sequelize = new Sequelize({
|
||||||
dialect: 'sqlite',
|
dialect: 'sqlite',
|
||||||
storage: 'database/database.sqlite',
|
storage: databasePath,
|
||||||
logging: false,
|
logging: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ services:
|
|||||||
- SECRET_KEY=your_secret_key_here
|
- SECRET_KEY=your_secret_key_here
|
||||||
- IS_DEMO=false # set to true to seed the database
|
- IS_DEMO=false # set to true to seed the database
|
||||||
volumes:
|
volumes:
|
||||||
- db-data:/app/database
|
- db-data:/app/backend/database
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
db-data:
|
db-data:
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
|
||||||
|
|
||||||
test('has title', async ({ page }) => {
|
|
||||||
await page.goto('http://localhost:8000/');
|
|
||||||
await expect(page).toHaveTitle('Open Source Test Case Management System | UnitTCMS');
|
|
||||||
});
|
|
||||||
12
e2e/not-demo-mode.spec.ts
Normal file
12
e2e/not-demo-mode.spec.ts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import { test, expect } from '@playwright/test';
|
||||||
|
|
||||||
|
test('If not demo mode, the landing page will not be displayed and will be redirected to the projects page.', async ({
|
||||||
|
page,
|
||||||
|
}) => {
|
||||||
|
const screenshotDir = 'playwright-screenshots/not-demo-redirect';
|
||||||
|
|
||||||
|
await page.goto('http://localhost:8000/');
|
||||||
|
await expect(page).toHaveURL(/\/projects/);
|
||||||
|
|
||||||
|
await page.screenshot({ path: `${screenshotDir}/landing-page-redirect.png`, fullPage: true });
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user