Skip to content

Latest commit

 

History

History
128 lines (120 loc) · 4.17 KB

CREDENTIALS.md

File metadata and controls

128 lines (120 loc) · 4.17 KB

Credentials

Each service plan defined at the settings file can have a single set of credentials. Credentials can be predefined (statically defined in the container or at the settings file), or generated randomly and injected into the container at provision/bind time.

Properties format

Each service plan defined at the settings file might contain the following properties:

Field Required Type Description
credentials N Hash Credentials properties.
credentials.username N Hash Properties to build the `username` credentials field [1].
credentials.username.key N String Name of the environment variable to pass to the container to set the service username.
credentials.username.value N String Username to send to the container via the environment variable. If not set, and `credentials.username.key` is set, the broker will create a random username.
credentials.password N Hash Properties to build the `password` credentials field [1].
credentials.password.key N String Name of the environment variable to pass to the container to set the service password.
credentials.password.value N String Password to send to the container via the environment variable. If not set, and `credentials.password.key` is set, the broker will create a random password.
credentials.dname N Hash Properties to build the `dbname` to append to the `uri` credentials field [1].
credentials.dbname.key N String Name of the environment variable to pass to the container to set the service dbname.
credentials.dbname.value N String Dbname to send to the container via the environment variable. If not set, and `credentials.dbname.key` is set, the broker will create a random dbname.
credentials.uri N Hash Properties to build the `uri` credentials field [1].
credentials.uri.prefix N String Prefix (ie `dbtype`) to add at the `uri` part of the credentials.
credentials.uri.port N String Container port to be exposed at the the `uri` part of the credentials (format: port</protocol>). The broker will translate this port to the real exposed host port. This field is not required unless your container exposes more than 1 port (ie the server port and the web ui port) and you just want to send one of them to the application binding.

[1] See Binding credentials

Example

This example will use a predefined username named admin and it will create a random password and dbname. Credentials will be sent to the container using the environment variables SERVICE_USERNAME, SERVICE_PASSWORD and SERVICE_DBNAME respectively. When an application is bound to the service, it will receive a credentials hash with an URI following this pattern: mongodb://admin:<RANDOM PASSWORD>@<HOST IP>:<HOST PORT MAPPED TO CONTAINER PORT 27017/tcp>/<RANDOM DBNAME>.

credentials:
  username:
    key: 'SERVICE_USERNAME'
    value: 'admin'
  password:
    key: 'SERVICE_PASSWORD'
  dbname:
    key: 'SERVICE_DBNAME'
  uri:
    prefix: 'mongodb'
    port: '27017/tcp'