Move obsidian reference to a proxy at /metadata and make it env configurable with OBSIDIAN_BEACHHEAD_SERVER.
This commit is contained in:
parent
cfec7982e0
commit
cf6e26b890
1
.gitignore
vendored
1
.gitignore
vendored
@ -22,3 +22,4 @@ dist-ssr
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
/.env
|
||||
|
||||
@ -61,7 +61,7 @@ export function LargeSelect() {
|
||||
queryKey: ['obsidian-metadata'],
|
||||
initialData: [],
|
||||
queryFn: async () => {
|
||||
const response = await fetch("http://100.115.154.44:9002/metadata")
|
||||
const response = await fetch("/metadata")
|
||||
const fullData: any[] = await response.json();
|
||||
|
||||
return R.sortBy(v => -(v.data.backlinks?.length ?? 0), fullData.map(md => ({
|
||||
|
||||
@ -1,10 +1,21 @@
|
||||
import {defineConfig} from 'vite'
|
||||
import { defineConfig, loadEnv } from 'vite'
|
||||
import react from '@vitejs/plugin-react-swc'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
server: {
|
||||
host: '0.0.0.0'
|
||||
export default defineConfig(({ command, mode }) => {
|
||||
// Load env file based on `mode` in the current working directory.
|
||||
// Set the third parameter to '' to load all env regardless of the `VITE_` prefix.
|
||||
const env = loadEnv(mode, process.cwd(), '')
|
||||
|
||||
return {
|
||||
plugins: [react()],
|
||||
server: {
|
||||
host: '0.0.0.0',
|
||||
proxy: {
|
||||
'/metadata': {
|
||||
target: env['OBSIDIAN_BEACHHEAD_SERVER']
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user