Skip to content

A modern platform for visual, flexible, and extensible graph-based investigations. For cybersecurity analysts and investigators.

refactor: use only .env api url value

dextmorgncdf754ece69c
diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml
index f4481cdc..68283a03 100644
--- a/docker-compose.dev.yml
+++ b/docker-compose.dev.yml
@@ -140,7 +140,7 @@ services:
- ./flowsint-app:/app
- /app/node_modules
environment:
- - VITE_API_URL=http://localhost:5001
+ - VITE_API_URL=${VITE_API_URL}
networks:
- flowsint_network
stdin_open: true
diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml
index 6d497d63..14340fd5 100644
--- a/docker-compose.prod.yml
+++ b/docker-compose.prod.yml
@@ -125,7 +125,7 @@ services:
context: ./flowsint-app
dockerfile: Dockerfile
args:
- - VITE_API_URL=${VITE_API_URL:-http://localhost:5001}
+ - VITE_API_URL=${VITE_API_URL}
container_name: flowsint-app-prod
restart: always
ports:
diff --git a/docker-compose.yml b/docker-compose.yml
index fd536ca5..7b46fd6d 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -59,7 +59,7 @@ services:
- ./flowsint-app:/app
- app_node_modules:/app/node_modules
environment:
- - VITE_API_URL=http://localhost:5001
+ - VITE_API_URL=${VITE_API_URL}
networks:
- flowsint_network
stdin_open: true
diff --git a/flowsint-api/app/main.py b/flowsint-api/app/main.py
index e33c641e..3f821e44 100644
--- a/flowsint-api/app/main.py
+++ b/flowsint-api/app/main.py
@@ -24,20 +24,7 @@ USERNAME = os.getenv("NEO4J_USERNAME")
PASSWORD = os.getenv("NEO4J_PASSWORD")
origins = [
- "http://localhost:3000",
- "http://127.0.0.1:3000",
- "http://localhost:3001",
- "http://127.0.0.1:3001",
- "http://app.flowsint.localhost",
- "https://app.flowsint.localhost",
- "http://localhost:5174",
- "http://127.0.0.1:5174",
- "http://localhost:5173",
- "http://127.0.0.1:5173",
- "http://localhost:3005",
- "http://127.0.0.1:3005",
- "http://localhost:5001",
- "http://127.0.0.1:5001",
+ "*",
]
diff --git a/flowsint-app/src/hooks/use-events.ts b/flowsint-app/src/hooks/use-events.ts
index 6a20d0ce..2cba3b57 100644
--- a/flowsint-app/src/hooks/use-events.ts
+++ b/flowsint-app/src/hooks/use-events.ts
@@ -5,6 +5,9 @@ import { EventLevel } from '@/types'
import { useGraphControls } from '@/stores/graph-controls-store'
import { queryKeys } from '@/api/query-keys'
+const API_URL = import.meta.env.VITE_API_URL
+
+
export function useEvents(sketch_id: string | undefined) {
const [liveLogs, setLiveLogs] = useState<Event[]>([])
// const [graphUpdates, setGraphUpdates] = useState<{ nodes: GraphNode[]; edges: GraphEdge[] }[]>([])
@@ -27,7 +30,7 @@ export function useEvents(sketch_id: string | undefined) {
if (!sketch_id) return
const eventSource = new EventSource(
- `http://localhost:5001/api/events/sketch/${sketch_id}/stream`
+ `${API_URL}api/events/sketch/${sketch_id}/stream`
)
eventSource.onmessage = (e) => {
diff --git a/flowsint-app/vite.config.ts b/flowsint-app/vite.config.ts
index 15d0b1d1..2029652a 100644
--- a/flowsint-app/vite.config.ts
+++ b/flowsint-app/vite.config.ts
@@ -1,11 +1,15 @@
import { tanstackRouter } from '@tanstack/router-plugin/vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
-import { defineConfig } from 'vite'
+import { defineConfig, loadEnv } from 'vite'
import { resolve } from 'path'
-export default defineConfig({
- plugins: [
+export default defineConfig(({ mode }) => {
+ const env = loadEnv(mode, process.cwd(), '')
+ const apiUrl = env.VITE_API_URL
+
+ return {
+ plugins: [
tailwindcss(),
{
...tanstackRouter({
@@ -25,25 +29,26 @@ export default defineConfig({
// plugins: ["babel-plugin-react-compiler"]
}
})
- ],
- resolve: {
- alias: {
- '@': resolve(__dirname, 'src')
- }
- },
- server: {
- open: true,
- proxy: {
- '/api': {
- target: 'http://localhost:5001',
- changeOrigin: true,
- secure: false
+ ],
+ resolve: {
+ alias: {
+ '@': resolve(__dirname, 'src')
}
+ },
+ server: {
+ open: true,
+ proxy: {
+ '/api': {
+ target: apiUrl,
+ changeOrigin: true,
+ secure: false
+ }
+ }
+ },
+ preview: {
+ open: false,
+ host: '0.0.0.0',
+ port: 5173
}
- },
- preview: {
- open: false,
- host: '0.0.0.0',
- port: 5173
}
})