mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-06-01 07:10:48 +00:00
Expose supervisor API to app by allowing all requests from 127.0.0.1 and passing address and port as env vars
This commit is contained in:
parent
7f7a550363
commit
0fd03054e8
@ -1,3 +1,4 @@
|
||||
* Expose supervisor API to app by allowing all requests from 127.0.0.1 and passing address and port as env vars [Pablo]
|
||||
* Only apply special actions / boot config on change, and always persist to DB [Pablo]
|
||||
|
||||
# v0.0.18
|
||||
|
@ -12,7 +12,7 @@ module.exports = (secret, application) ->
|
||||
api = express()
|
||||
api.use(bodyParser())
|
||||
api.use (req, res, next) ->
|
||||
if req.query.apikey is secret
|
||||
if req.ip is '127.0.0.1' or req.query.apikey is secret
|
||||
next()
|
||||
else
|
||||
res.sendStatus(401)
|
||||
|
@ -100,6 +100,8 @@ exports.connectivityCheck = _.once ->
|
||||
exports.extendEnvVars = (env, uuid) ->
|
||||
newEnv =
|
||||
RESIN_DEVICE_UUID: uuid
|
||||
RESIN_SUPERVISOR_ADDRESS: 'http://127.0.0.1:' + config.listenPort
|
||||
RESIN_SUPERVISOR_PORT: config.listenPort
|
||||
RESIN: '1'
|
||||
USER: 'root'
|
||||
if env?
|
||||
|
Loading…
x
Reference in New Issue
Block a user