diff --git a/DEPLOYMENT_GUIDE.md b/DEPLOYMENT_GUIDE.md index bc115b7..6f40d3d 100644 --- a/DEPLOYMENT_GUIDE.md +++ b/DEPLOYMENT_GUIDE.md @@ -180,7 +180,7 @@ docker-compose up -d # Run database migrations docker-compose exec backend npm run migrate -# Admin credentials will be displayed and saved to ADMIN_CREDENTIALS.txt +# Admin credentials will be displayed and saved to /data/ADMIN_CREDENTIALS.txt ``` #### Step 4: Configure Nginx diff --git a/backend/migrations/core/001_init.js b/backend/migrations/core/001_init.js index 6efe491..9471d8f 100644 --- a/backend/migrations/core/001_init.js +++ b/backend/migrations/core/001_init.js @@ -26,7 +26,15 @@ exports.up = async function(knex) { }); // Save the generated password to a file for the user to retrieve - const setupInfoPath = path.join(__dirname, '..', '..', 'ADMIN_CREDENTIALS.txt'); + const dataDir = path.join(__dirname, '..', '..', 'data'); + const setupInfoPath = path.join(dataDir, 'ADMIN_CREDENTIALS.txt'); + + // Ensure data directory exists + try { + await fs.mkdir(dataDir, { recursive: true }); + } catch (error) { + // Directory might already exist, that's okay + } const setupInfo = ` ======================================== PicPeak Admin Credentials @@ -58,8 +66,8 @@ Generated on: ${new Date().toISOString()} console.log(`Password: ${generatedPassword}`); console.log('\n⚠️ IMPORTANT:'); console.log('1. Save these credentials securely'); - console.log('2. You will be required to change the password on first login'); - console.log('3. Credentials are also saved in: ADMIN_CREDENTIALS.txt'); + console.log('2. Please change the password after first login'); + console.log('3. Credentials are also saved in: data/ADMIN_CREDENTIALS.txt'); console.log('========================================\n'); }