Skip to main content
Glama
environment.ts1.36 kB
import { FiveMConfig } from '../types/index.js'; import * as path from 'path'; import * as os from 'os'; /** * Get FiveM server configuration from environment variables */ export function getFiveMConfig(): Partial<FiveMConfig> { // デフォルトのログディレクトリパスを設定 const defaultLogsDir = process.env.PWD ? path.join(process.env.PWD, 'local/txData/default/logs') : 'local/txData/default/logs'; // FiveMクライアントのデフォルトログディレクトリを設定 let defaultClientLogsDir: string; if (process.platform === 'win32') { defaultClientLogsDir = path.join(os.homedir(), 'AppData', 'Local', 'FiveM', 'FiveM.app', 'logs'); } else { // Linux/WSL2の場合 defaultClientLogsDir = path.join(os.homedir(), '.local', 'share', 'CitizenFX'); } return { host: process.env.RCON_ADDRESS, port: process.env.RCON_PORT ? parseInt(process.env.RCON_PORT, 10) : undefined, password: process.env.RCON_PASSWORD, logsDir: process.env.FIVEM_LOGS_DIR || defaultLogsDir, clientLogsDir: process.env.FIVEM_CLIENT_LOGS_DIR || defaultClientLogsDir }; } /** * Check if environment variables are configured for auto-connection */ export function hasAutoConnectConfig(): boolean { const config = getFiveMConfig(); return !!(config.host && config.port && config.password); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/eeharumt/fivem-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server