mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-02-20 17:52:51 +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",
|
"bluebird": "~1.1.1",
|
||||||
"JSONStream": "~0.7.1",
|
"JSONStream": "~0.7.1",
|
||||||
"event-stream": "~3.0.20",
|
"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": {
|
"engines": {
|
||||||
"node": "0.10.22"
|
"node": "0.10.22"
|
||||||
|
@ -8,6 +8,8 @@ Docker = require 'dockerode'
|
|||||||
Promise = require 'bluebird'
|
Promise = require 'bluebird'
|
||||||
request = Promise.promisify require 'request'
|
request = Promise.promisify require 'request'
|
||||||
JSONStream = require 'JSONStream'
|
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'))
|
docker = Promise.promisifyAll(new Docker(socketPath: '/run/docker.sock'))
|
||||||
# Hack dockerode to promisify internal classes' prototypes
|
# Hack dockerode to promisify internal classes' prototypes
|
||||||
@ -84,14 +86,17 @@ exports.update = ->
|
|||||||
.then ([[apiKey], [uuid], apps]) ->
|
.then ([[apiKey], [uuid], apps]) ->
|
||||||
apiKey = apiKey.value
|
apiKey = apiKey.value
|
||||||
uuid = uuid.value
|
uuid = uuid.value
|
||||||
request(
|
resinAPI.get(
|
||||||
method: 'GET'
|
resource: 'application'
|
||||||
url: url.resolve(process.env.API_ENDPOINT, "/ewa/application?$filter=device/uuid eq '#{uuid}'&apikey=#{apiKey}")
|
options:
|
||||||
json: true
|
filter:
|
||||||
|
'device/uuid': uuid
|
||||||
|
customOptions:
|
||||||
|
apikey: apiKey
|
||||||
)
|
)
|
||||||
.spread (request, body) ->
|
.then (remoteApps) ->
|
||||||
console.log("Remote apps")
|
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(remoteApps)
|
||||||
|
|
||||||
console.log("Local apps")
|
console.log("Local apps")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user