All checks were successful
Docker Deploy / build-and-push (push) Successful in 3m26s
49 lines
1.1 KiB
TypeScript
49 lines
1.1 KiB
TypeScript
import type { APIRoute } from "astro";
|
|
import {
|
|
getSpotifyCredentials,
|
|
isSpotifyConfigured,
|
|
} from "../../../utils/spotify";
|
|
|
|
export const GET: APIRoute = async () => {
|
|
try {
|
|
const isConfigured = isSpotifyConfigured();
|
|
|
|
if (!isConfigured) {
|
|
const credentials = getSpotifyCredentials();
|
|
console.log(
|
|
"Spotify integration disabled - missing environment variables:",
|
|
{
|
|
hasClientId: !!credentials?.clientId,
|
|
hasClientSecret: !!credentials?.clientSecret,
|
|
hasRefreshToken: !!credentials?.refreshToken,
|
|
},
|
|
);
|
|
}
|
|
|
|
return new Response(
|
|
JSON.stringify({
|
|
configured: isConfigured,
|
|
}),
|
|
{
|
|
status: 200,
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
},
|
|
},
|
|
);
|
|
} catch (error) {
|
|
console.error("Error checking Spotify configuration:", error);
|
|
return new Response(
|
|
JSON.stringify({
|
|
configured: false,
|
|
}),
|
|
{
|
|
status: 200,
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
},
|
|
},
|
|
);
|
|
}
|
|
};
|