feat: setup S2S integration, tailwind fixes, admin routing, nginx fallback
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
const mongoose = require('mongoose');
|
||||
const dotenv = require('dotenv');
|
||||
const path = require('path');
|
||||
|
||||
dotenv.config({ path: path.join(__dirname, '../.env') });
|
||||
|
||||
const Config = require('../models/Config');
|
||||
const { encrypt } = require('../utils/crypto');
|
||||
|
||||
const PERFECT_CORP_API_KEY = 'sk-tHtPU8rst9cifrM6RhkjCKy9EpNfXBdcoCbzP0QDRhIkHr_InBYPS6g_6XGSumbm';
|
||||
const PERFECT_CORP_SECRET_KEY = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCKexD/nyLrGq7jXCxYi/Tjwr297cZS5EUFQbCV9NO2XQU/sJitsT2WBHHS8AYAQrzM56hPgnwpt/B+EuSuLfVbM/ympBUvSrULUNlrJF5lW96JMd1KF8RWC9fICZJuCE2iGpGAd0l9pOCUmYM4JZ/n26HxZxSSramkoOYxmhFYhQIDAQAB';
|
||||
|
||||
async function seedKeys() {
|
||||
try {
|
||||
await mongoose.connect(process.env.MONGO_URI || 'mongodb://mongo:27017/limelite');
|
||||
console.log('Connected to DB');
|
||||
|
||||
// 1. API KEY
|
||||
const encryptedApi = encrypt(PERFECT_CORP_API_KEY);
|
||||
await Config.findOneAndUpdate(
|
||||
{ keyName: 'PERFECT_CORP_API_KEY' },
|
||||
{ encryptedValue: encryptedApi.encryptedData, iv: encryptedApi.iv },
|
||||
{ upsert: true, new: true }
|
||||
);
|
||||
|
||||
// 2. SECRET KEY
|
||||
const encryptedSecret = encrypt(PERFECT_CORP_SECRET_KEY);
|
||||
await Config.findOneAndUpdate(
|
||||
{ keyName: 'PERFECT_CORP_SECRET_KEY' },
|
||||
{ encryptedValue: encryptedSecret.encryptedData, iv: encryptedSecret.iv },
|
||||
{ upsert: true, new: true }
|
||||
);
|
||||
|
||||
console.log('Successfully encrypted and stored Perfect Corp API keys in the database.');
|
||||
process.exit(0);
|
||||
} catch (error) {
|
||||
console.error('Error seeding keys:', error);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
seedKeys();
|
||||
Reference in New Issue
Block a user