- sendcoins
- font - catalogo
This commit is contained in:
@@ -763,10 +763,13 @@ connectToDatabase(connectionUrl, options)
|
||||
const isProduction = ['production', 'test'].includes(process.env.NODE_ENV);
|
||||
|
||||
let domains = [];
|
||||
let domains_allowed = [];
|
||||
|
||||
try {
|
||||
if (process.env.DOMAINS)
|
||||
domains = JSON.parse(process.env.DOMAINS);
|
||||
if (process.env.DOMAINS_ALLOWED)
|
||||
domains_allowed = JSON.parse(process.env.DOMAINS_ALLOWED);
|
||||
} catch (error) {
|
||||
console.error("Errore durante la conversione della stringa DOMAINS:", error);
|
||||
}
|
||||
@@ -805,17 +808,23 @@ connectToDatabase(connectionUrl, options)
|
||||
`https://api.${domain.hostname}`,
|
||||
`https://test.${domain.hostname}`,
|
||||
`https://testapi.${domain.hostname}`,
|
||||
`https://comunitanuovomondo.app`,
|
||||
`https://kolibrilab.it`,
|
||||
`https://artenergetica.org`,
|
||||
`https://freeplanet.app:3001`,
|
||||
`http://${domain.hostname}`,
|
||||
`http://api.${domain.hostname}`,
|
||||
`http://test.${domain.hostname}`,
|
||||
`http://testapi.${domain.hostname}`
|
||||
]);
|
||||
|
||||
// Aggiungi i domini da DOMAINS_ALLOWED
|
||||
allowedOrigins = allowedOrigins.concat(
|
||||
domains_allowed.map(domain => [
|
||||
`https://${domain}`,
|
||||
`http://${domain}`
|
||||
]).flat()
|
||||
);
|
||||
}
|
||||
|
||||
console.log('allowedOrigins', allowedOrigins)
|
||||
|
||||
|
||||
let myorigin = '*';
|
||||
|
||||
@@ -823,6 +832,10 @@ connectToDatabase(connectionUrl, options)
|
||||
myorigin = (origin, callback) => {
|
||||
try {
|
||||
// Validazione dell'input
|
||||
if (origin === undefined) {
|
||||
console.log('✅ Origin UNDEFINED... vado avanti lo stesso !');
|
||||
return callback(null, true);
|
||||
}
|
||||
if (!origin || typeof origin !== 'string' || !/^https?:\/\/[^\s/$.?#].[^\s]*$/.test(origin)) {
|
||||
console.error('❌ Origine non valida:', origin);
|
||||
return callback(new Error('Origine non valida'), false);
|
||||
@@ -830,7 +843,7 @@ connectToDatabase(connectionUrl, options)
|
||||
|
||||
// Controllo delle origini consentite
|
||||
if (allowedOrigins.includes(origin)) {
|
||||
console.log('✅ Origine consentita:', origin);
|
||||
// console.log('✅ Origine consentita:', origin);
|
||||
return callback(null, true);
|
||||
}
|
||||
|
||||
@@ -939,10 +952,10 @@ connectToDatabase(connectionUrl, options)
|
||||
|
||||
const keyStream = path.resolve(`./${process.env.PATH_CERT_KEY}`);
|
||||
const certificateStream = path.resolve(`./${process.env.PATH_SERVER_CRT}`);
|
||||
|
||||
|
||||
const privateKey = fs.readFileSync(keyStream, "utf8");
|
||||
const certificate = fs.readFileSync(certificateStream, "utf8");
|
||||
|
||||
|
||||
mycredentials = {
|
||||
key: privateKey,
|
||||
cert: certificate,
|
||||
|
||||
Reference in New Issue
Block a user