mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-06-04 08:40:49 +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]
|
* Only apply special actions / boot config on change, and always persist to DB [Pablo]
|
||||||
|
|
||||||
# v0.0.18
|
# v0.0.18
|
||||||
|
@ -12,7 +12,7 @@ module.exports = (secret, application) ->
|
|||||||
api = express()
|
api = express()
|
||||||
api.use(bodyParser())
|
api.use(bodyParser())
|
||||||
api.use (req, res, next) ->
|
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()
|
next()
|
||||||
else
|
else
|
||||||
res.sendStatus(401)
|
res.sendStatus(401)
|
||||||
|
@ -100,6 +100,8 @@ exports.connectivityCheck = _.once ->
|
|||||||
exports.extendEnvVars = (env, uuid) ->
|
exports.extendEnvVars = (env, uuid) ->
|
||||||
newEnv =
|
newEnv =
|
||||||
RESIN_DEVICE_UUID: uuid
|
RESIN_DEVICE_UUID: uuid
|
||||||
|
RESIN_SUPERVISOR_ADDRESS: 'http://127.0.0.1:' + config.listenPort
|
||||||
|
RESIN_SUPERVISOR_PORT: config.listenPort
|
||||||
RESIN: '1'
|
RESIN: '1'
|
||||||
USER: 'root'
|
USER: 'root'
|
||||||
if env?
|
if env?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user