Kaynağa Gözat

Make stacks public by default

Alan Colon 7 yıl önce
ebeveyn
işleme
36ebd370a2
2 değiştirilmiş dosya ile 11 ekleme ve 2 silme
  1. 10 1
      lib/client.js
  2. 1 1
      package.json

+ 10 - 1
lib/client.js

@@ -94,11 +94,20 @@ const createClient = (config) => {
             })
         } else {
             log(`New stack ${opts.name}`)
-            return await call('POST', `/api/stacks?method=${encodeURIComponent(opts.method)}&type=${encodeURIComponent(type)}&endpointId=${encodeURIComponent(opts.endpointId)}`, {
+            const stack = await call('POST', `/api/stacks?method=${encodeURIComponent(opts.method)}&type=${encodeURIComponent(type)}&endpointId=${encodeURIComponent(opts.endpointId)}`, {
                 Name: opts.name,
                 StackFileContent: (opts.warning ? warning : '') + opts.stackFileContent,
                 SwarmID: opts.swarmId
             })
+            await call('POST', '/api/resource_controls', {
+                Type: 'stack',
+                Public: true,
+                ResourceID: opts.name,
+                Users: [],
+                Teams: [],
+                SubResourceIDs: []
+            })
+            return stack
         }
     }
     return { getEndpoints, getSwarms, getStacks, upsertStack, deleteStack }

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "portainer",
-  "version": "0.0.4",
+  "version": "0.0.5",
   "description": "Portainer command line deployment",
   "main": "lib/client.js",
   "bin": {