40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
import { prisma } from './prisma';
|
|
|
|
export async function getSiteSettings() {
|
|
// Default fallback values used during build or if DB is down
|
|
const defaultSettings = {
|
|
siteName: "Afrohub",
|
|
siteSlogan: "La plateforme de référence pour l'entrepreneuriat africain. Visibilité, connexion et croissance pour les TPE/PME.",
|
|
contactEmail: "support@afrohub.com",
|
|
address: "Abidjan, Côte d'Ivoire / Paris, France",
|
|
facebookUrl: "#",
|
|
twitterUrl: "#",
|
|
instagramUrl: "#",
|
|
linkedinUrl: "#",
|
|
footerText: "© 2025 Afrohub. Tous droits réservés.",
|
|
homeBlogShow: true,
|
|
homeBlogTitle: "Derniers Articles",
|
|
homeBlogSubtitle: "Toutes les actualités de l'entrepreneuriat africain.",
|
|
homeBlogCount: 3,
|
|
homeBlogSelection: "latest",
|
|
homeBlogIds: [],
|
|
homeBlogCategories: [],
|
|
homeCategories: ["Technologie & IT", "Agriculture & Agrobusiness", "Mode & Textile", "Cosmétique & Beauté"]
|
|
};
|
|
|
|
try {
|
|
const settings = await prisma.siteSetting.findUnique({
|
|
where: { id: 'singleton' }
|
|
});
|
|
|
|
if (!settings) return defaultSettings;
|
|
return settings;
|
|
} catch (error) {
|
|
// 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;
|
|
}
|
|
}
|