32 lines
1.4 KiB
JavaScript
32 lines
1.4 KiB
JavaScript
const fs = require('fs');
|
|
|
|
async function main() {
|
|
const tokenData = JSON.parse(fs.readFileSync('D:/cumin/ghaymah_dns_net_sec_tests/token.json', 'utf8'));
|
|
const res = await fetch('https://graphql.ghaymah.systems/v1/graphql', {
|
|
method: 'POST',
|
|
headers: { 'Authorization': 'Bearer ' + tokenData.token, 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({
|
|
query: `query GetResources($userId: uuid) {
|
|
ghaymah_cloud_resources(where: { user_id: { _eq: $userId }, deleted: { _eq: false } }) {
|
|
id chart_name status values message
|
|
}
|
|
}`,
|
|
variables: { userId: tokenData.userId }
|
|
})
|
|
});
|
|
const data = await res.json();
|
|
console.log('Total resources:', data.data?.ghaymah_cloud_resources?.length);
|
|
for (const r of data.data.ghaymah_cloud_resources) {
|
|
console.log(`\n[${r.chart_name}] ID: ${r.id} | Status: ${r.status} | Name: ${r.values?.name}`);
|
|
if (r.chart_name === 'ghaymah-app') {
|
|
console.log(' Container:', JSON.stringify(r.values?.container));
|
|
console.log(' Ports:', JSON.stringify(r.values?.ports));
|
|
console.log(' PublicAccess:', JSON.stringify(r.values?.publicAccess));
|
|
console.log(' Project ID:', r.values?.projectId);
|
|
if (r.values?.command) console.log(' Command:', r.values?.command);
|
|
if (r.values?.env) console.log(' Env:', JSON.stringify(r.values?.env));
|
|
}
|
|
}
|
|
}
|
|
main().catch(console.error);
|