refactor(config): separate base URL from API URL for CLI usage
Add signUrl property to config for CLI sign URL without /api/v1 suffix. Update CLIGuidePage to use config.signUrl instead of hardcoded URL. Update .env.example and add .swarm/ to .gitignore.
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
||||
VITE_API_BASE_URL=http://localhost:5000/api/v1
|
||||
VITE_API_BASE_URL=http://localhost:5000
|
||||
|
||||
+3
-1
@@ -23,4 +23,6 @@ dist-ssr
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
*.env
|
||||
*.env
|
||||
|
||||
.swarm/
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 20 KiB |
+7
-1
@@ -1,12 +1,18 @@
|
||||
// Secuird Configuration
|
||||
// Environment-specific settings for the application
|
||||
|
||||
// Base URL without /api/v1 suffix - used for CLI sign URL
|
||||
const BASE_URL = import.meta.env.VITE_API_BASE_URL || "http://192.168.64.7:8888";
|
||||
|
||||
export const config = {
|
||||
// API Configuration
|
||||
api: {
|
||||
baseUrl: import.meta.env.VITE_API_BASE_URL || "http://192.168.64.7:8888/api/v1",
|
||||
baseUrl: `${BASE_URL}/api/v1`,
|
||||
},
|
||||
|
||||
// Sign URL for CLI (same as base URL, no /api/v1)
|
||||
signUrl: BASE_URL,
|
||||
|
||||
// App metadata
|
||||
app: {
|
||||
name: "Secuird",
|
||||
|
||||
@@ -6,8 +6,7 @@ import {
|
||||
CollapsibleContent,
|
||||
CollapsibleTrigger,
|
||||
} from "@/components/ui/collapsible";
|
||||
|
||||
const SIGN_URL = "https://api.secuird.tech";
|
||||
import { config } from "@/config";
|
||||
|
||||
// ── Code block with copy button ────────────────────────────────────────────────
|
||||
function CodeBlock({ code }: { code: string }) {
|
||||
@@ -112,7 +111,7 @@ export default function CLIGuidePage() {
|
||||
</Step>
|
||||
|
||||
<Step n={3} title="Set your server URL">
|
||||
<CodeBlock code={`echo 'SIGN_URL=${SIGN_URL}' > ~/.secuird/.env`} />
|
||||
<CodeBlock code={`echo 'SIGN_URL=${config.signUrl}' > ~/.secuird/.env`} />
|
||||
</Step>
|
||||
|
||||
<Step n={4} title="Register your SSH key (once)">
|
||||
|
||||
Reference in New Issue
Block a user