Runway

dsn

Services are currently in public beta, with additional features—such as enhanced statistics and support for more service types—set to roll out in the coming weeks.

The runway service dsn <name> command generates a Data Source Name (DSN) for your service and sets it as an environment variable, making it immediately available for automation and seamless integration with your applications.

DSNs are supported by a number of frameworks and represent the credential string that is necessary for your application to connect to e.g. a database. We support PostgreSQL (DATABASE_URL) and Cache (REDIS_URL).

$ runway service dsn db-test
DATABASE_URL=postgres://app:xxx@db-test-rw.db-test.svc.cluster.local:5432/app

Example

A concious example to show case automation:

$ runway app create -a my-new-app
...
$ runway service create new-db --type postgres --plan std-launch
...
$ runway app config set $(runway service dsn new-db) -a my-new-app
...

What is a DSN?

A DSN is essentially a formatted connection string that provides all the necessary details for an application to connect to a database or service. It typically includes information such as the username, password, host, port, database name, and sometimes additional connection options. For example, a DSN for PostgreSQL might look like this:

postgres://username:password@hostname:port/database?sslmode=require

By using this command, Runway eliminates the need to manually configure or retrieve connection details. The DSN is automatically prepared and injected into your app’s environment via (runway app config set), ensuring that your services are ready to use with minimal setup. This approach simplifies workflows, supports automation, and ensures consistency across deployments.