mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-19 13:47:54 +00:00
Merge pull request #3 from resin-io/RES-1323-keys-in-makefile
Default PubNub and Mixpanel keys are now passed at build time
This commit is contained in:
commit
584d0b54cc
@ -1,3 +1,5 @@
|
||||
* Use buildtime env vars as the default Pubnub and Mixpanel keys [Pablo]
|
||||
|
||||
# v1.1.0
|
||||
|
||||
* Switch back to using arch-based node images [Pablo]
|
||||
|
7
Makefile
7
Makefile
@ -12,6 +12,10 @@ all: supervisor
|
||||
IMAGE = "resin/$(ARCH)-supervisor:$(SUPERVISOR_VERSION)"
|
||||
SUPERVISOR_IMAGE=$(DEPLOY_REGISTRY)$(IMAGE)
|
||||
|
||||
PUBNUB_SUBSCRIBE_KEY = sub-c-bananas
|
||||
PUBNUB_PUBLISH_KEY = pub-c-bananas
|
||||
MIXPANEL_TOKEN = bananasbananas
|
||||
|
||||
ifeq ($(ARCH),rpi)
|
||||
GOARCH = arm
|
||||
endif
|
||||
@ -54,6 +58,9 @@ stop-supervisor:
|
||||
supervisor: gosuper
|
||||
cp Dockerfile.$(ARCH) Dockerfile
|
||||
echo "ENV VERSION "`jq -r .version package.json` >> Dockerfile
|
||||
echo "ENV DEFAULT_PUBNUB_PUBLISH_KEY $(PUBNUB_PUBLISH_KEY)" >> Dockerfile
|
||||
echo "ENV DEFAULT_PUBNUB_SUBSCRIBE_KEY $(PUBNUB_SUBSCRIBE_KEY)" >> Dockerfile
|
||||
echo "ENV DEFAULT_MIXPANEL_TOKEN $(MIXPANEL_TOKEN)" >> Dockerfile
|
||||
docker build --no-cache=$(DISABLE_CACHE) -t $(IMAGE) .
|
||||
-rm Dockerfile
|
||||
|
||||
|
@ -12,5 +12,19 @@ docker pull resin/${ARCH}-supervisor:${ESCAPED_BRANCH_NAME} || docker pull resin
|
||||
make SUPERVISOR_VERSION=${VERSION} JOB_NAME=${JOB_NAME} test-gosuper
|
||||
|
||||
# Build the images
|
||||
make SUPERVISOR_VERSION=${ESCAPED_BRANCH_NAME} ARCH=${ARCH} JOB_NAME=${JOB_NAME} DEPLOY_REGISTRY= deploy
|
||||
make SUPERVISOR_VERSION=${VERSION} ARCH=${ARCH} JOB_NAME=${JOB_NAME} DEPLOY_REGISTRY= deploy
|
||||
make SUPERVISOR_VERSION=${ESCAPED_BRANCH_NAME} \
|
||||
ARCH=${ARCH} \
|
||||
JOB_NAME=${JOB_NAME} \
|
||||
DEPLOY_REGISTRY= \
|
||||
PUBNUB_SUBSCRIBE_KEY=${PUBNUB_SUBSCRIBE_KEY} \
|
||||
PUBNUB_PUBLISH_KEY=${PUBNUB_PUBLISH_KEY} \
|
||||
MIXPANEL_TOKEN=${MIXPANEL_TOKEN} \
|
||||
deploy
|
||||
make SUPERVISOR_VERSION=${VERSION} \
|
||||
ARCH=${ARCH} \
|
||||
JOB_NAME=${JOB_NAME} \
|
||||
DEPLOY_REGISTRY= \
|
||||
PUBNUB_SUBSCRIBE_KEY=${PUBNUB_SUBSCRIBE_KEY} \
|
||||
PUBNUB_PUBLISH_KEY=${PUBNUB_PUBLISH_KEY} \
|
||||
MIXPANEL_TOKEN=${MIXPANEL_TOKEN} \
|
||||
deploy
|
||||
|
@ -7,15 +7,21 @@ checkInt = (s) ->
|
||||
return
|
||||
return i
|
||||
|
||||
checkValidKey = (s) ->
|
||||
# Make sure `s` exists and is not an empty string, or 'null'.
|
||||
if !s? or s == 'null' or s == ''
|
||||
return
|
||||
return s
|
||||
|
||||
module.exports = config =
|
||||
apiEndpoint: process.env.API_ENDPOINT ? 'https://api.resin.io'
|
||||
listenPort: process.env.LISTEN_PORT ? 80
|
||||
gosuperAddress: "http://unix:#{process.env.GOSUPER_SOCKET}:"
|
||||
registryEndpoint: process.env.REGISTRY_ENDPOINT ? 'registry.resin.io'
|
||||
pubnub:
|
||||
subscribe_key: process.env.PUBNUB_SUBSCRIBE_KEY ? 'sub-c-bananas'
|
||||
publish_key: process.env.PUBNUB_PUBLISH_KEY ? 'pub-c-bananas'
|
||||
mixpanelToken: process.env.MIXPANEL_TOKEN ? 'bananasbananas'
|
||||
subscribe_key: checkValidKey(process.env.PUBNUB_SUBSCRIBE_KEY) ? process.env.DEFAULT_PUBNUB_SUBSCRIBE_KEY
|
||||
publish_key: checkValidKey(process.env.PUBNUB_PUBLISH_KEY) ? process.env.DEFAULT_PUBNUB_PUBLISH_KEY
|
||||
mixpanelToken: checkValidKey(process.env.MIXPANEL_TOKEN) ? process.env.DEFAULT_MIXPANEL_TOKEN
|
||||
dockerSocket: process.env.DOCKER_SOCKET ? '/run/docker.sock'
|
||||
supervisorImage: process.env.SUPERVISOR_IMAGE ? 'resin/rpi-supervisor'
|
||||
configMountPoint: process.env.CONFIG_MOUNT_POINT ? '/mnt/mmcblk0p1/config.json'
|
||||
|
Loading…
Reference in New Issue
Block a user