TSURU_SERVICES environment variable

tsuru exports an special environment variable in applications that useservices, this variable is named TSURU_SERVICES.The value of this example is a JSON describing all services instances that theapplication uses. Here is an example of the value of this variable:

  1. {
  2. "mysql": [
  3. {"instance_name": "mydb",
  4. "envs": {"DATABASE_NAME": "mydb",
  5. "DATABASE_USER": "mydb",
  6. "DATABASE_PASSWORD": "secret",
  7. "DATABASE_HOST": "mysql.mycompany.com"}
  8. },
  9. {"instance_name": "otherdb",
  10. "envs": {"DATABASE_NAME": "otherdb",
  11. "DATABASE_USER": "otherdb",
  12. "DATABASE_PASSWORD": "secret",
  13. "DATABASE_HOST": "mysql.mycompany.com"}
  14. }],
  15. "redis": [
  16. {"instance_name": "powerredis",
  17. "envs": {"REDIS_HOST": "remote.redis.company.com:6379"}
  18. }],
  19. "mongodb": []
  20. }

As described in the structure, the value of the environment variable is a JSONobject, where each key represents a service. In the example above, there arethree services: mysql, redis and mongodb. Each service contains a list ofservice instances, and each instance have a name and a map of environmentvariables.

原文: https://docs.tsuru.io/1.6/services/tsuru-services-env-var.html