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
|
||||||
|
|||||||
@@ -24,3 +24,5 @@ dist-ssr
|
|||||||
*.sw?
|
*.sw?
|
||||||
|
|
||||||
*.env
|
*.env
|
||||||
|
|
||||||
|
.swarm/
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 20 KiB |
+7
-1
@@ -1,12 +1,18 @@
|
|||||||
// Secuird Configuration
|
// Secuird Configuration
|
||||||
// Environment-specific settings for the application
|
// 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 = {
|
export const config = {
|
||||||
// API Configuration
|
// API Configuration
|
||||||
api: {
|
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 metadata
|
||||||
app: {
|
app: {
|
||||||
name: "Secuird",
|
name: "Secuird",
|
||||||
|
|||||||
@@ -6,8 +6,7 @@ import {
|
|||||||
CollapsibleContent,
|
CollapsibleContent,
|
||||||
CollapsibleTrigger,
|
CollapsibleTrigger,
|
||||||
} from "@/components/ui/collapsible";
|
} from "@/components/ui/collapsible";
|
||||||
|
import { config } from "@/config";
|
||||||
const SIGN_URL = "https://api.secuird.tech";
|
|
||||||
|
|
||||||
// ── Code block with copy button ────────────────────────────────────────────────
|
// ── Code block with copy button ────────────────────────────────────────────────
|
||||||
function CodeBlock({ code }: { code: string }) {
|
function CodeBlock({ code }: { code: string }) {
|
||||||
@@ -112,7 +111,7 @@ export default function CLIGuidePage() {
|
|||||||
</Step>
|
</Step>
|
||||||
|
|
||||||
<Step n={3} title="Set your server URL">
|
<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>
|
||||||
|
|
||||||
<Step n={4} title="Register your SSH key (once)">
|
<Step n={4} title="Register your SSH key (once)">
|
||||||
|
|||||||
Reference in New Issue
Block a user