2014-10-14 11:31:37 +01:00
|
|
|
checkInt = (s) ->
|
|
|
|
# Make sure `s` exists and is not an empty string.
|
|
|
|
if !s
|
|
|
|
return
|
|
|
|
i = parseInt(s, 10)
|
|
|
|
if isNaN(i)
|
|
|
|
return
|
|
|
|
return i
|
|
|
|
|
2016-02-12 10:33:18 -03:00
|
|
|
checkString = (s) ->
|
|
|
|
# Make sure `s` exists and is not an empty string, or 'null' or 'undefined'.
|
|
|
|
# This might happen if the parsing of config.json on the host using jq is wrong (it is buggy in some versions).
|
|
|
|
if !s? or s == 'null' or s == 'undefined' or s == ''
|
2015-10-14 18:50:26 -03:00
|
|
|
return
|
|
|
|
return s
|
|
|
|
|
2016-02-12 10:33:18 -03:00
|
|
|
dockerRoot = checkString(process.env.DOCKER_ROOT) ? '/mnt/root/var/lib/rce'
|
2016-01-20 14:56:09 +00:00
|
|
|
|
2016-01-06 20:59:10 +05:30
|
|
|
# Defaults needed for both gosuper and node supervisor are declared in entry.sh
|
2014-05-12 00:15:10 +01:00
|
|
|
module.exports = config =
|
2016-02-12 10:33:18 -03:00
|
|
|
apiEndpoint: checkString(process.env.API_ENDPOINT) ? 'https://api.resin.io'
|
|
|
|
listenPort: checkInt(process.env.LISTEN_PORT) ? 80
|
2015-07-24 14:26:33 -03:00
|
|
|
gosuperAddress: "http://unix:#{process.env.GOSUPER_SOCKET}:"
|
2016-02-12 10:33:18 -03:00
|
|
|
deltaHost: checkString(process.env.DELTA_ENDPOINT) ? 'https://delta.resin.io'
|
|
|
|
registryEndpoint: checkString(process.env.REGISTRY_ENDPOINT) ? 'registry.resin.io'
|
2014-05-12 00:15:10 +01:00
|
|
|
pubnub:
|
2016-02-12 10:33:18 -03:00
|
|
|
subscribe_key: checkString(process.env.PUBNUB_SUBSCRIBE_KEY) ? process.env.DEFAULT_PUBNUB_SUBSCRIBE_KEY
|
|
|
|
publish_key: checkString(process.env.PUBNUB_PUBLISH_KEY) ? process.env.DEFAULT_PUBNUB_PUBLISH_KEY
|
|
|
|
mixpanelToken: checkString(process.env.MIXPANEL_TOKEN) ? process.env.DEFAULT_MIXPANEL_TOKEN
|
2015-12-21 20:14:43 +05:30
|
|
|
dockerSocket: process.env.DOCKER_SOCKET
|
2016-02-12 10:33:18 -03:00
|
|
|
supervisorImage: checkString(process.env.SUPERVISOR_IMAGE) ? 'resin/rpi-supervisor'
|
|
|
|
configMountPoint: checkString(process.env.CONFIG_MOUNT_POINT) ? '/mnt/mmcblk0p1/config.json'
|
|
|
|
ledFile: checkString(process.env.LED_FILE) ? '/sys/class/leds/led0/brightness'
|
2014-10-14 11:31:37 +01:00
|
|
|
bootstrapRetryDelay: checkInt(process.env.BOOTSTRAP_RETRY_DELAY_MS) ? 30000
|
|
|
|
restartSuccessTimeout: checkInt(process.env.RESTART_SUCCESS_TIMEOUT) ? 60000
|
2014-10-14 11:38:50 +01:00
|
|
|
appUpdatePollInterval: checkInt(process.env.APPLICATION_UPDATE_POLL_INTERVAL) ? 60000
|
2014-09-03 23:01:27 +00:00
|
|
|
successMessage: 'SUPERVISOR OK'
|
2015-11-02 13:16:43 -03:00
|
|
|
forceSecret:
|
2016-02-12 10:33:18 -03:00
|
|
|
api: checkString(process.env.RESIN_SUPERVISOR_SECRET) ? null
|
|
|
|
logsChannel: checkString(process.env.RESIN_SUPERVISOR_LOGS_CHANNEL) ? null
|
|
|
|
vpnStatusPath: checkString(process.env.VPN_STATUS_PATH) ? '/mnt/root/run/openvpn/vpn_status'
|
2015-10-01 17:42:52 +05:30
|
|
|
checkInt: checkInt
|
2016-02-12 10:33:18 -03:00
|
|
|
hostOsVersionPath: checkString(process.env.HOST_OS_VERSION_PATH) ? '/mnt/root/etc/os-release'
|
2016-01-20 14:56:09 +00:00
|
|
|
dockerRoot: dockerRoot
|
2016-02-12 10:33:18 -03:00
|
|
|
btrfsRoot: checkString(process.env.BTRFS_ROOT) ? "#{dockerRoot}/btrfs/subvolumes"
|