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:
- {
- "mysql": [
- {"instance_name": "mydb",
- "envs": {"DATABASE_NAME": "mydb",
- "DATABASE_USER": "mydb",
- "DATABASE_PASSWORD": "secret",
- "DATABASE_HOST": "mysql.mycompany.com"}
- },
- {"instance_name": "otherdb",
- "envs": {"DATABASE_NAME": "otherdb",
- "DATABASE_USER": "otherdb",
- "DATABASE_PASSWORD": "secret",
- "DATABASE_HOST": "mysql.mycompany.com"}
- }],
- "redis": [
- {"instance_name": "powerredis",
- "envs": {"REDIS_HOST": "remote.redis.company.com:6379"}
- }],
- "mongodb": []
- }
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