mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-01-18 18:56:24 +00:00
Refactor to use a different name for the env vars (otherwise resin-vars overrides it with a null value)
This commit is contained in:
parent
33d402c3c0
commit
4bcba5adf6
@ -1,4 +1,4 @@
|
||||
* Remove default Pubnub and Mixpanel keys as they are now passed at build time [Pablo]
|
||||
* Use buildtime env vars as the default Pubnub and Mixpanel keys [Pablo]
|
||||
|
||||
# v1.1.0
|
||||
|
||||
|
6
Makefile
6
Makefile
@ -58,9 +58,9 @@ stop-supervisor:
|
||||
supervisor: gosuper
|
||||
cp Dockerfile.$(ARCH) Dockerfile
|
||||
echo "ENV VERSION "`jq -r .version package.json` >> Dockerfile
|
||||
echo "ENV PUBNUB_PUBLISH_KEY $(PUBNUB_PUBLISH_KEY)" >> Dockerfile
|
||||
echo "ENV PUBNUB_SUBSCRIBE_KEY $(PUBNUB_SUBSCRIBE_KEY)" >> Dockerfile
|
||||
echo "ENV MIXPANEL_TOKEN $(MIXPANEL_TOKEN)" >> 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
|
||||
|
||||
|
@ -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 ? ''
|
||||
publish_key: process.env.PUBNUB_PUBLISH_KEY ? ''
|
||||
mixpanelToken: process.env.MIXPANEL_TOKEN ? ''
|
||||
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