ConceptsEnvironment & env groups
References
A reference is a value that Ferry replaces with the real value each time a container starts.
You save DATABASE_URL=${{datastore.app-db.connectionString}}.
1 / 4
A value can contain a reference: ${{kind.name.property}}. Ferry resolves it each time a container starts. Thus an app always gets the current host, port or password.
The three parts
| Part | Meaning | Example |
|---|---|---|
kind | datastore or service | datastore |
name | The name of the datastore or the service | app-db |
property | What you want from it | connectionString |
See the properties of a datastore and of a service.
Use references
ferry env set api \
'DATABASE_URL=${{datastore.app-db.connectionString}}' \
'REDIS_URL=${{datastore.cache.connectionString}}' \
'SEARCH_URL=${{service.search.internalUrl}}/v1'The reference syntax page has the full grammar.
To write a literal ${{, escape it as $${{. The value $${{ not.a.ref }} reaches the app as ${{ not.a.ref }}.
References also reach builds: Ferry gives the variables to the build with their references resolved. If Ferry cannot resolve a reference yet, it leaves the variable out of the build. The build log has a warning.