This commit is contained in:
@@ -1,40 +1,32 @@
|
||||
import { prisma } from './prisma';
|
||||
|
||||
export async function getSiteSettings() {
|
||||
// Default fallback values used during build or if DB is down
|
||||
const defaultSettings = {
|
||||
siteName: "Afropreunariat",
|
||||
siteSlogan: "La plateforme de référence pour l'entrepreneuriat africain. Visibilité, connexion et croissance pour les TPE/PME.",
|
||||
contactEmail: "support@afropreunariat.com",
|
||||
contactPhone: "+225 00 00 00 00 00",
|
||||
address: "Abidjan, Côte d'Ivoire / Paris, France",
|
||||
facebookUrl: "#",
|
||||
twitterUrl: "#",
|
||||
instagramUrl: "#",
|
||||
linkedinUrl: "#",
|
||||
footerText: "© 2025 Afropreunariat. Tous droits réservés."
|
||||
};
|
||||
|
||||
try {
|
||||
const settings = await prisma.siteSetting.findUnique({
|
||||
where: { id: 'singleton' }
|
||||
});
|
||||
|
||||
// Default fallback values if not initialized
|
||||
const defaultSettings = {
|
||||
siteName: "Afropreunariat",
|
||||
siteSlogan: "La plateforme de référence pour l'entrepreneuriat africain. Visibilité, connexion et croissance pour les TPE/PME.",
|
||||
contactEmail: "support@afropreunariat.com",
|
||||
contactPhone: "+225 00 00 00 00 00",
|
||||
address: "Abidjan, Côte d'Ivoire / Paris, France",
|
||||
facebookUrl: "#",
|
||||
twitterUrl: "#",
|
||||
instagramUrl: "#",
|
||||
linkedinUrl: "#",
|
||||
footerText: "© 2025 Afropreunariat. Tous droits réservés."
|
||||
};
|
||||
|
||||
if (!settings) return defaultSettings;
|
||||
return settings;
|
||||
} catch (error) {
|
||||
console.error("Failed to fetch site settings:", error);
|
||||
return {
|
||||
siteName: "Afropreunariat",
|
||||
siteSlogan: "La plateforme de référence pour l'entrepreneuriat africain.",
|
||||
contactEmail: "support@afropreunariat.com",
|
||||
contactPhone: "",
|
||||
address: "",
|
||||
facebookUrl: "#",
|
||||
twitterUrl: "#",
|
||||
instagramUrl: "#",
|
||||
linkedinUrl: "#",
|
||||
footerText: "© 2025 Afropreunariat. Tous droits réservés."
|
||||
};
|
||||
// Silently log only if not in build phase to keep CI logs clean
|
||||
if (process.env.NEXT_PHASE !== 'phase-production-build') {
|
||||
console.error("Database connection failed, using default site settings.");
|
||||
}
|
||||
return defaultSettings;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user