Share the docker socket via config.

This commit is contained in:
Page 2014-06-15 12:34:16 +01:00 committed by Pablo Carranza Vélez
parent 959da25c9f
commit 0d2d372cb9
3 changed files with 3 additions and 4 deletions

View File

@ -10,11 +10,10 @@ Promise = require 'bluebird'
JSONStream = require 'JSONStream' JSONStream = require 'JSONStream'
PlatformAPI = require 'resin-platform-api/request' PlatformAPI = require 'resin-platform-api/request'
DOCKER_SOCKET = '/run/docker.sock'
PLATFORM_ENDPOINT = url.resolve(config.apiEndpoint, '/ewa/') PLATFORM_ENDPOINT = url.resolve(config.apiEndpoint, '/ewa/')
resinAPI = new PlatformAPI(PLATFORM_ENDPOINT) resinAPI = new PlatformAPI(PLATFORM_ENDPOINT)
docker = Promise.promisifyAll(new Docker(socketPath: DOCKER_SOCKET)) docker = Promise.promisifyAll(new Docker(socketPath: config.dockerSocket))
# Hack dockerode to promisify internal classes' prototypes # Hack dockerode to promisify internal classes' prototypes
Promise.promisifyAll(docker.getImage().__proto__) Promise.promisifyAll(docker.getImage().__proto__)
Promise.promisifyAll(docker.getContainer().__proto__) Promise.promisifyAll(docker.getContainer().__proto__)

View File

@ -4,6 +4,7 @@ module.exports = config =
pubnub: pubnub:
subscribe_key: process.env.PUBNUB_SUBSCRIBE_KEY subscribe_key: process.env.PUBNUB_SUBSCRIBE_KEY
publish_key: process.env.PUBNUB_PUBLISH_KEY publish_key: process.env.PUBNUB_PUBLISH_KEY
dockerSocket: '/run/docker.sock'
expectedEnvVars: [ expectedEnvVars: [
'API_ENDPOINT' 'API_ENDPOINT'
'REGISTRY_ENDPOINT' 'REGISTRY_ENDPOINT'

View File

@ -4,9 +4,8 @@ Promise = require 'bluebird'
JSONStream = require 'JSONStream' JSONStream = require 'JSONStream'
config = require './config' config = require './config'
DOCKER_SOCKET = '/run/docker.sock'
docker = Promise.promisifyAll(new Docker(socketPath: DOCKER_SOCKET)) docker = Promise.promisifyAll(new Docker(socketPath: config.dockerSocket))
# Hack dockerode to promisify internal classes' prototypes # Hack dockerode to promisify internal classes' prototypes
Promise.promisifyAll(docker.getImage().__proto__) Promise.promisifyAll(docker.getImage().__proto__)
Promise.promisifyAll(docker.getContainer().__proto__) Promise.promisifyAll(docker.getContainer().__proto__)