25 lines
687 B
JavaScript
25 lines
687 B
JavaScript
|
|
export default async function handler(req, res) {
|
||
|
|
if (req.method !== 'GET') {
|
||
|
|
return res.status(405).json({ error: 'Method not allowed' });
|
||
|
|
}
|
||
|
|
|
||
|
|
try {
|
||
|
|
// Get Gemini API key from environment
|
||
|
|
const geminiApiKey = process.env.GEMINI_AI_API_KEY;
|
||
|
|
|
||
|
|
if (geminiApiKey) {
|
||
|
|
return res.status(200).json({
|
||
|
|
hasKey: true,
|
||
|
|
apiKey: geminiApiKey
|
||
|
|
});
|
||
|
|
} else {
|
||
|
|
return res.status(200).json({
|
||
|
|
hasKey: false,
|
||
|
|
message: 'No Gemini API key found in environment'
|
||
|
|
});
|
||
|
|
}
|
||
|
|
} catch (error) {
|
||
|
|
console.error('Error getting Gemini config:', error);
|
||
|
|
return res.status(500).json({ error: 'Internal server error' });
|
||
|
|
}
|
||
|
|
}
|