56 lines
1.5 KiB
JavaScript
56 lines
1.5 KiB
JavaScript
import { defineConfig } from 'vite';
|
|
import vue from '@vitejs/plugin-vue';
|
|
import { fileURLToPath, URL } from 'node:url';
|
|
|
|
export default defineConfig({
|
|
plugins: [vue()],
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
}
|
|
},
|
|
server: {
|
|
host: '0.0.0.0',
|
|
port: 5173,
|
|
strictPort: true, // Fail if port is already in use instead of trying next available port
|
|
proxy: {
|
|
// API v1 proxy (legacy)
|
|
'/api/challonge/v1': {
|
|
target: 'https://api.challonge.com/v1',
|
|
changeOrigin: true,
|
|
rewrite: path => path.replace(/^\/api\/challonge\/v1/, ''),
|
|
secure: true,
|
|
headers: {
|
|
Accept: 'application/json',
|
|
'Content-Type': 'application/json'
|
|
}
|
|
},
|
|
// API v2.1 proxy (current)
|
|
'/api/challonge/v2.1': {
|
|
target: 'https://api.challonge.com/v2.1',
|
|
changeOrigin: true,
|
|
rewrite: path => path.replace(/^\/api\/challonge\/v2\.1/, ''),
|
|
secure: true,
|
|
headers: {
|
|
Accept: 'application/json',
|
|
'Content-Type': 'application/vnd.api+json'
|
|
}
|
|
},
|
|
// OAuth proxy (token exchange)
|
|
'/api/oauth': {
|
|
target: 'http://localhost:3001',
|
|
changeOrigin: true,
|
|
rewrite: path => path.replace(/^\/api\/oauth/, '/oauth'),
|
|
secure: false
|
|
},
|
|
// Gamemaster API proxy
|
|
'/api/gamemaster': {
|
|
target: 'http://localhost:3001',
|
|
changeOrigin: true,
|
|
rewrite: path => path,
|
|
secure: false
|
|
}
|
|
}
|
|
}
|
|
});
|