Fixed spotify
All checks were successful
Docker Deploy / build-and-push (push) Successful in 3m26s

This commit is contained in:
2025-06-19 23:34:44 -06:00
parent 7161584dcd
commit 41614a49a8
8 changed files with 413 additions and 282 deletions

View File

@ -1,40 +1,48 @@
import type { APIRoute } from 'astro';
import type { APIRoute } from "astro";
import {
getSpotifyCredentials,
isSpotifyConfigured,
} from "../../../utils/spotify";
export const GET: APIRoute = async () => {
try {
// Only check environment variables at runtime, not build time
const clientId = process.env.SPOTIFY_CLIENT_ID;
const clientSecret = process.env.SPOTIFY_CLIENT_SECRET;
const refreshToken = process.env.SPOTIFY_REFRESH_TOKEN;
const isConfigured = isSpotifyConfigured();
const isConfigured = !!(clientId && clientSecret && refreshToken);
if (!isConfigured) {
console.log('Spotify integration disabled - missing environment variables:', {
hasClientId: !!clientId,
hasClientSecret: !!clientSecret,
hasRefreshToken: !!refreshToken
});
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',
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',
console.error("Error checking Spotify configuration:", error);
return new Response(
JSON.stringify({
configured: false,
}),
{
status: 200,
headers: {
"Content-Type": "application/json",
},
},
});
);
}
};
};