ConceptsDatastores
Connect a service
A reference gives the internal URL of a datastore to your service. Do not paste the URL.
You set a variable. Its value is a reference to the datastore.
1 / 3
Set the variable
Give the URL of the datastore to your app in an environment variable.
ferry env set api 'DATABASE_URL=${{datastore.app-db.connectionString}}'
ferry env set worker 'REDIS_URL=${{datastore.cache.connectionString}}'connectionString is the internal URL. It works on the private network only.
Do not paste the URL
In a service, use a reference. Then the service always gets the current value.
Other properties
A reference can also give one part of the URL.
| Property | Value |
|---|---|
host, port | The internal host and port |
user, password, database | The parts of the connection string |
externalConnectionString | The external URL |
Environment explains the references. For a full example with migrations, see Deploy an app with Postgres.