Использование redis в качестве моего хранилища сеансов в моем приложении express.js. У меня проблемы. Сузили их к проблеме подключения.Переменные среды Docker, dokku-redis
Как получить доступ к переменной среды docker из приложения express.js? Я использую докку-redis.
Сообщается, что переменные окружения автоматически настраиваются в связанном приложении ... Я связал свое приложение. running dokku redis: info foo показывает, что все связано. Я пытаюсь тянуть в REDIS_URL
Спасибо, Роб
https://github.com/dokku/dokku-redis
------------
a redis service can be linked to a
container this will use native docker
links via the docker-options plugin
here we link it to our 'playground' app
NOTE: this will restart your app
dokku redis:link lolipop playground
the following environment variables will be set automatically by docker (not on the app itself, so they won’t be listed when calling dokku config)
DOKKU_REDIS_LOLIPOP_NAME=/lolipop/DATABASE
DOKKU_REDIS_LOLIPOP_PORT=tcp://172.17.0.1:6379
DOKKU_REDIS_LOLIPOP_PORT_6379_TCP=tcp://172.17.0.1:6379
DOKKU_REDIS_LOLIPOP_PORT_6379_TCP_PROTO=tcp
DOKKU_REDIS_LOLIPOP_PORT_6379_TCP_PORT=6379
DOKKU_REDIS_LOLIPOP_PORT_6379_TCP_ADDR=172.17.0.1
and the following will be set on the linked application by default
REDIS_URL=redis://lolipop:[email protected]:6379
NOTE: the host exposed here only works internally in docker containers. If
you want your container to be reachable from outside, you should use 'expose'.
------------------------------
Edit - извините, я забыл добавить, что я попытался process.env
process.env - ваш друг – GottZ