-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathastro.config.mjs
More file actions
34 lines (32 loc) · 1.04 KB
/
astro.config.mjs
File metadata and controls
34 lines (32 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { defineConfig } from 'astro/config';
import tailwind from '@astrojs/tailwind';
import react from '@astrojs/react'; // Add this line
// Determine site URL based on environment
const getSiteURL = () => {
// For Vercel production deployment
if (process.env.VERCEL_URL) {
return `https://${process.env.VERCEL_URL}`;
}
// For Vercel preview deployment
if (process.env.VERCEL_BRANCH_URL) {
return `https://${process.env.VERCEL_BRANCH_URL}`;
}
// For local development
return 'http://localhost:4321';
};
// https://astro.build/config
export default defineConfig({
site: getSiteURL(),
integrations: [
tailwind(),
react(),
],
vite: {
// Đảm bảo biến môi trường được chuyển đến client
define: {
'import.meta.env.SPOTIFY_CLIENT_ID': JSON.stringify(process.env.SPOTIFY_CLIENT_ID),
'import.meta.env.SPOTIFY_CLIENT_SECRET': JSON.stringify(process.env.SPOTIFY_CLIENT_SECRET),
'import.meta.env.SPOTIFY_REFRESH_TOKEN': JSON.stringify(process.env.SPOTIFY_REFRESH_TOKEN),
},
},
});