From 0d2d372cb9c6bc3187b13b8230982b48aeb0e47e Mon Sep 17 00:00:00 2001 From: Page Date: Sun, 15 Jun 2014 12:34:16 +0100 Subject: [PATCH] Share the docker socket via config. --- src/application.coffee | 3 +-- src/config.coffee | 1 + src/supervisor-update.coffee | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/application.coffee b/src/application.coffee index fb5632e1..2b0ad705 100644 --- a/src/application.coffee +++ b/src/application.coffee @@ -10,11 +10,10 @@ Promise = require 'bluebird' JSONStream = require 'JSONStream' PlatformAPI = require 'resin-platform-api/request' -DOCKER_SOCKET = '/run/docker.sock' PLATFORM_ENDPOINT = url.resolve(config.apiEndpoint, '/ewa/') 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 Promise.promisifyAll(docker.getImage().__proto__) Promise.promisifyAll(docker.getContainer().__proto__) diff --git a/src/config.coffee b/src/config.coffee index 2447a7e7..1862727c 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -4,6 +4,7 @@ module.exports = config = pubnub: subscribe_key: process.env.PUBNUB_SUBSCRIBE_KEY publish_key: process.env.PUBNUB_PUBLISH_KEY + dockerSocket: '/run/docker.sock' expectedEnvVars: [ 'API_ENDPOINT' 'REGISTRY_ENDPOINT' diff --git a/src/supervisor-update.coffee b/src/supervisor-update.coffee index 4f6abb9c..781675e0 100644 --- a/src/supervisor-update.coffee +++ b/src/supervisor-update.coffee @@ -4,9 +4,8 @@ Promise = require 'bluebird' JSONStream = require 'JSONStream' 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 Promise.promisifyAll(docker.getImage().__proto__) Promise.promisifyAll(docker.getContainer().__proto__)