Skip to content

Commit

Permalink
add info endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
s4ke committed Nov 13, 2023
1 parent 5e83182 commit 785706e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions swarmgate/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ app.get('/_ping', async (req, res) => {
app.get('/version', async (req, res) => {
try {
const versionInfo = await docker.version();
console.log(versionInfo);
res.json(versionInfo);
} catch (error: any) {
res.status(500).json({ message: error.message });
Expand Down Expand Up @@ -171,6 +170,16 @@ app.get('/:version/info', async (req, res) => {
}
});

app.get('/info', async (req, res) => {
try {
const info = await docker.info();
res.json(info);
} catch (error: any) {
res.status(500).json({ message: error.message });
}
});


// Services
function isServiceOwned(service: Docker.Service): boolean {
if (!service.Spec?.Labels) {
Expand Down Expand Up @@ -807,7 +816,6 @@ app.post('/:version/volumes/create', async (req, res) => {
volumeSpec.Labels = { ...volumeSpec.Labels, [label]: labelValue };

try {
console.log(volumeSpec);
if (!volumeSpec.Driver) {
res.status(400).send(`Volume driver is required.`);
return;
Expand Down

0 comments on commit 785706e

Please sign in to comment.