mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-02-18 17:00:25 +00:00
Use the resin-platform-api to access the platform.
This commit is contained in:
parent
c8d8ca9736
commit
a5aaee107d
@ -16,7 +16,8 @@
|
||||
"bluebird": "~1.1.1",
|
||||
"JSONStream": "~0.7.1",
|
||||
"event-stream": "~3.0.20",
|
||||
"sqlite3": "~2.1.19"
|
||||
"sqlite3": "~2.1.19",
|
||||
"resin-platform-api": "git+ssh://git@bitbucket.org:rulemotion/resin-platform-api.git#v0.2.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": "0.10.22"
|
||||
|
@ -8,6 +8,8 @@ Docker = require 'dockerode'
|
||||
Promise = require 'bluebird'
|
||||
request = Promise.promisify require 'request'
|
||||
JSONStream = require 'JSONStream'
|
||||
PlatformAPI = require 'resin-platform-api/request'
|
||||
resinAPI = new PlatformAPI(url.resolve(process.env.API_ENDPOINT, '/ewa/'))
|
||||
|
||||
docker = Promise.promisifyAll(new Docker(socketPath: '/run/docker.sock'))
|
||||
# Hack dockerode to promisify internal classes' prototypes
|
||||
@ -84,14 +86,17 @@ exports.update = ->
|
||||
.then ([[apiKey], [uuid], apps]) ->
|
||||
apiKey = apiKey.value
|
||||
uuid = uuid.value
|
||||
request(
|
||||
method: 'GET'
|
||||
url: url.resolve(process.env.API_ENDPOINT, "/ewa/application?$filter=device/uuid eq '#{uuid}'&apikey=#{apiKey}")
|
||||
json: true
|
||||
resinAPI.get(
|
||||
resource: 'application'
|
||||
options:
|
||||
filter:
|
||||
'device/uuid': uuid
|
||||
customOptions:
|
||||
apikey: apiKey
|
||||
)
|
||||
.spread (request, body) ->
|
||||
.then (remoteApps) ->
|
||||
console.log("Remote apps")
|
||||
remoteApps = ("registry.resin.io/#{path.basename(app.git_repository, '.git')}/#{app.commit}" for app in body.d when app.commit)
|
||||
remoteApps = ("registry.resin.io/#{path.basename(app.git_repository, '.git')}/#{app.commit}" for app in remoteApps when app.commit)
|
||||
console.log(remoteApps)
|
||||
|
||||
console.log("Local apps")
|
||||
|
Loading…
x
Reference in New Issue
Block a user