mirror of
https://github.com/9technologygroup/patchmon.net.git
synced 2025-11-09 16:37:29 +00:00
Should fix host configs generating with default params.
Another issue, caused by the wack prisma migration.
This commit is contained in:
@@ -738,8 +738,8 @@ const CredentialsModal = ({ host, isOpen, onClose }) => {
|
|||||||
queryKey: ['serverUrl'],
|
queryKey: ['serverUrl'],
|
||||||
queryFn: () => settingsAPI.getServerUrl().then(res => res.data),
|
queryFn: () => settingsAPI.getServerUrl().then(res => res.data),
|
||||||
})
|
})
|
||||||
|
|
||||||
const serverUrl = serverUrlData?.serverUrl || 'http://localhost:3001'
|
const serverUrl = serverUrlData?.server_url || 'http://localhost:3001'
|
||||||
|
|
||||||
const copyToClipboard = (text) => {
|
const copyToClipboard = (text) => {
|
||||||
navigator.clipboard.writeText(text)
|
navigator.clipboard.writeText(text)
|
||||||
@@ -831,12 +831,12 @@ echo " - View logs: tail -f /var/log/patchmon-agent.log"`
|
|||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
value={`curl -s ${serverUrl}/api/v1/hosts/install | bash -s -- ${serverUrl} "${host.apiId}" "${host.apiKey}"`}
|
value={`curl -s ${serverUrl}/api/v1/hosts/install | bash -s -- ${serverUrl} "${host.api_id}" "${host.api_key}"`}
|
||||||
readOnly
|
readOnly
|
||||||
className="flex-1 px-3 py-2 border border-primary-300 dark:border-primary-600 rounded-md bg-white dark:bg-secondary-800 text-sm font-mono text-secondary-900 dark:text-white"
|
className="flex-1 px-3 py-2 border border-primary-300 dark:border-primary-600 rounded-md bg-white dark:bg-secondary-800 text-sm font-mono text-secondary-900 dark:text-white"
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
onClick={() => copyToClipboard(`curl -s ${serverUrl}/api/v1/hosts/install | bash -s -- ${serverUrl} "${host.apiId}" "${host.apiKey}"`)}
|
onClick={() => copyToClipboard(`curl -s ${serverUrl}/api/v1/hosts/install | bash -s -- ${serverUrl} "${host.api_id}" "${host.api_key}"`)}
|
||||||
className="btn-primary flex items-center gap-1"
|
className="btn-primary flex items-center gap-1"
|
||||||
>
|
>
|
||||||
<Copy className="h-4 w-4" />
|
<Copy className="h-4 w-4" />
|
||||||
@@ -894,12 +894,12 @@ echo " - View logs: tail -f /var/log/patchmon-agent.log"`
|
|||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
value={`sudo /usr/local/bin/patchmon-agent.sh configure "${host.apiId}" "${host.apiKey}"`}
|
value={`sudo /usr/local/bin/patchmon-agent.sh configure "${host.api_id}" "${host.api_key}"`}
|
||||||
readOnly
|
readOnly
|
||||||
className="flex-1 px-3 py-2 border border-secondary-300 dark:border-secondary-600 rounded-md bg-white dark:bg-secondary-800 text-sm font-mono text-secondary-900 dark:text-white"
|
className="flex-1 px-3 py-2 border border-secondary-300 dark:border-secondary-600 rounded-md bg-white dark:bg-secondary-800 text-sm font-mono text-secondary-900 dark:text-white"
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
onClick={() => copyToClipboard(`sudo /usr/local/bin/patchmon-agent.sh configure "${host.apiId}" "${host.apiKey}"`)}
|
onClick={() => copyToClipboard(`sudo /usr/local/bin/patchmon-agent.sh configure "${host.api_id}" "${host.api_key}"`)}
|
||||||
className="btn-secondary flex items-center gap-1"
|
className="btn-secondary flex items-center gap-1"
|
||||||
>
|
>
|
||||||
<Copy className="h-4 w-4" />
|
<Copy className="h-4 w-4" />
|
||||||
|
|||||||
@@ -226,11 +226,11 @@ const CredentialsModal = ({ host, isOpen, onClose }) => {
|
|||||||
enabled: isOpen // Only fetch when modal is open
|
enabled: isOpen // Only fetch when modal is open
|
||||||
})
|
})
|
||||||
|
|
||||||
const serverUrl = settings?.serverUrl || window.location.origin.replace(':3000', ':3001')
|
const serverUrl = settings?.server_url || window.location.origin.replace(':3000', ':3001')
|
||||||
|
|
||||||
const getSetupCommands = () => {
|
const getSetupCommands = () => {
|
||||||
return {
|
return {
|
||||||
oneLine: `curl -sSL ${serverUrl}/api/v1/hosts/install | bash -s -- ${serverUrl} "${host?.apiId}" "${host?.apiKey}"`,
|
oneLine: `curl -sSL ${serverUrl}/api/v1/hosts/install | bash -s -- ${serverUrl} "${host?.api_id}" "${host?.api_key}"`,
|
||||||
|
|
||||||
download: `# Download and setup PatchMon agent
|
download: `# Download and setup PatchMon agent
|
||||||
curl -o /tmp/patchmon-agent.sh ${serverUrl}/api/v1/hosts/agent/download
|
curl -o /tmp/patchmon-agent.sh ${serverUrl}/api/v1/hosts/agent/download
|
||||||
@@ -239,7 +239,7 @@ sudo mv /tmp/patchmon-agent.sh /usr/local/bin/patchmon-agent.sh
|
|||||||
sudo chmod +x /usr/local/bin/patchmon-agent.sh`,
|
sudo chmod +x /usr/local/bin/patchmon-agent.sh`,
|
||||||
|
|
||||||
configure: `# Configure API credentials
|
configure: `# Configure API credentials
|
||||||
sudo /usr/local/bin/patchmon-agent.sh configure "${host?.apiId}" "${host?.apiKey}"`,
|
sudo /usr/local/bin/patchmon-agent.sh configure "${host?.api_id}" "${host?.api_key}"`,
|
||||||
|
|
||||||
test: `# Test the configuration
|
test: `# Test the configuration
|
||||||
sudo /usr/local/bin/patchmon-agent.sh test`,
|
sudo /usr/local/bin/patchmon-agent.sh test`,
|
||||||
@@ -265,7 +265,7 @@ sudo chmod +x /usr/local/bin/patchmon-agent.sh
|
|||||||
|
|
||||||
# Configure credentials
|
# Configure credentials
|
||||||
echo "🔑 Configuring API credentials..."
|
echo "🔑 Configuring API credentials..."
|
||||||
sudo /usr/local/bin/patchmon-agent.sh configure "${host?.apiId}" "${host?.apiKey}"
|
sudo /usr/local/bin/patchmon-agent.sh configure "${host?.api_id}" "${host?.api_key}"
|
||||||
|
|
||||||
# Test configuration
|
# Test configuration
|
||||||
echo "🧪 Testing configuration..."
|
echo "🧪 Testing configuration..."
|
||||||
|
|||||||
Reference in New Issue
Block a user