mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-01-20 11:38:51 +00:00
Merge pull request #153 from resin-io/152-log-to-stdout
Log useful supervisor info to stdout/stderr
This commit is contained in:
commit
bead6eb9c3
@ -1,3 +1,5 @@
|
||||
* Log useful supervisor info to stdout/stderr [Kostas]
|
||||
|
||||
# v1.10.0
|
||||
|
||||
* Fix progress bars on docker version 1.10 [Aleksis]
|
||||
|
@ -28,4 +28,6 @@ export DBUS_SYSTEM_BUS_ADDRESS="unix:path=/mnt/root/run/dbus/system_bus_socket"
|
||||
supervisorctl -c /etc/supervisor/supervisord.conf start resin-supervisor
|
||||
supervisorctl -c /etc/supervisor/supervisord.conf start go-supervisor
|
||||
|
||||
tail -f /var/log/supervisor/supervisord.log
|
||||
tail -F \
|
||||
/var/log/supervisor/supervisord.log \
|
||||
/var/log/resin_supervisor_stdout.log
|
||||
|
4
entry.sh
4
entry.sh
@ -30,4 +30,6 @@ export DBUS_SYSTEM_BUS_ADDRESS="unix:path=/mnt/root/run/dbus/system_bus_socket"
|
||||
supervisorctl start resin-supervisor
|
||||
supervisorctl start go-supervisor
|
||||
|
||||
tail -f /var/log/supervisor/supervisord.log
|
||||
tail -F \
|
||||
/var/log/supervisor/supervisord.log \
|
||||
/var/log/resin_supervisor_stdout.log
|
||||
|
@ -11,11 +11,6 @@ device = require './device'
|
||||
dockerUtils = require './docker-utils'
|
||||
_ = require 'lodash'
|
||||
|
||||
privateAppEnvVars = [
|
||||
'RESIN_SUPERVISOR_API_KEY'
|
||||
'RESIN_API_KEY'
|
||||
]
|
||||
|
||||
module.exports = (application) ->
|
||||
api = express()
|
||||
unparsedRouter = express.Router()
|
||||
@ -151,7 +146,7 @@ module.exports = (application) ->
|
||||
if !app?
|
||||
throw new Error('App not found')
|
||||
# Don't return keys on the endpoint
|
||||
app.env = _.omit(JSON.parse(app.env), privateAppEnvVars)
|
||||
app.env = _.omit(JSON.parse(app.env), config.privateAppEnvVars)
|
||||
# Don't return data that will be of no use to the user
|
||||
res.json(app)
|
||||
.catch (err) ->
|
||||
|
@ -44,3 +44,7 @@ module.exports = config =
|
||||
hostOsVersionPath: checkString(process.env.HOST_OS_VERSION_PATH) ? '/mnt/root/etc/os-release'
|
||||
dockerRoot: dockerRoot
|
||||
btrfsRoot: checkString(process.env.BTRFS_ROOT) ? "#{dockerRoot}/btrfs/subvolumes"
|
||||
privateAppEnvVars: [
|
||||
'RESIN_SUPERVISOR_API_KEY'
|
||||
'RESIN_API_KEY'
|
||||
]
|
||||
|
@ -36,6 +36,16 @@ exports.mixpanelTrack = (event, properties = {}) ->
|
||||
message: properties.error.message
|
||||
stack: properties.error.stack
|
||||
|
||||
# Don't log private env vars (e.g. api keys)
|
||||
if properties?.app?.env?
|
||||
try
|
||||
{ env } = properties.app
|
||||
env = JSON.parse(env) if _.isString(env)
|
||||
safeEnv = _.omit(env, config.privateAppEnvVars)
|
||||
properties.app.env = JSON.stringify(safeEnv)
|
||||
catch
|
||||
properties.app.env = 'Fully hidden due to error in selective hiding'
|
||||
|
||||
console.log('Event:', event, JSON.stringify(properties))
|
||||
# Mutation is bad, and it should feel bad
|
||||
properties = _.assign(_.cloneDeep(properties), mixpanelProperties)
|
||||
|
Loading…
Reference in New Issue
Block a user