mirror of
https://github.com/marcogll/ap_pos.git
synced 2026-01-13 13:15:16 +00:00
feat: Release version 1.3.1 with Docker optimization and comprehensive documentation
- Update version to 1.3.1 in package.json and docker-compose.yml - Optimize Dockerfile with proper data directory structure for production - Add comprehensive Docker documentation (DOCKER.md) - Include deployment and backup scripts (deploy.sh, backup.sh) - Add .env.example for environment configuration - Improve README with detailed deployment instructions - Fix database path handling for Docker production environment - Add health checks and proper Docker Compose configuration - Remove development task documentation - Update .gitignore to exclude backup directories 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
12
server.js
12
server.js
@@ -25,8 +25,10 @@ app.use(session({
|
||||
}));
|
||||
|
||||
// --- DATABASE INITIALIZATION ---
|
||||
// Usar un path absoluto para asegurar que la DB siempre se cree en la carpeta del proyecto.
|
||||
const dbPath = path.join(__dirname, 'ap-pos.db');
|
||||
// Usar un path que funcione tanto en desarrollo como en Docker
|
||||
const dbPath = process.env.NODE_ENV === 'production'
|
||||
? path.join(__dirname, 'data', 'ap-pos.db')
|
||||
: path.join(__dirname, 'ap-pos.db');
|
||||
console.log(`Connecting to database at: ${dbPath}`);
|
||||
|
||||
const db = new sqlite3.Database(dbPath, (err) => {
|
||||
@@ -144,7 +146,11 @@ function startServer() {
|
||||
|
||||
// Middleware para manejar la redirección a la página de configuración
|
||||
const checkSetup = (req, res, next) => {
|
||||
const allowedPaths = ['/setup.html', '/setup.js', '/api/setup', '/styles.css', '/src/logo.png', '/api/check-auth'];
|
||||
const allowedPaths = [
|
||||
'/setup.html', '/setup.js', '/api/setup',
|
||||
'/login.html', '/login.js', '/api/login',
|
||||
'/styles.css', '/src/logo.png', '/api/check-auth'
|
||||
];
|
||||
if (needsSetup && !allowedPaths.includes(req.path)) {
|
||||
return res.redirect('/setup.html');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user