Updating Legacy Templates

2 years ago

As you may have noticed, the template building experience recently got a whole lot better with the new Template Composer.

To fully adopt the new Template Composer flow, we must convert “legacy” templates (those that predate the Composer) into composable templates. Part of this conversion drops support for auto-injection of variables attached to data sources that were once Legacy Plugins.

What does this mean, what changed?

With the Legacy Template flow + Legacy Plugins, some magic was happening under the hood that made all Legacy Plugin variables available to other services in the template automatically. Since releasing Database Services and the Template Composer, this auto-injection is no longer necessary.

What do I need to do?

To ensure successful conversion, simply verify that services which connect to your datasources are configured with the variables necessary to establish connection.

  1. Check the service source code or documentation for how it is accessing the data source. For example -

  • if you have a Redis service in your template, you may find in your service code:
    const redis = new Redis(process.env.REDIS_PRIVATE_URL + '?family=0’);

  • if you have a Postgres service in your template, you may find in your service code:
    postgres_url = os.environ["DATABASE_PRIVATE_URL"]

  1. In the service settings, add the variable as a Reference Variable like so:

  • for Redis, for example:
    REDIS_PRIVATE_URL=${{Redis.REDIS_PRIVATE_URL }}

  • for Postgres, for example:
    DATABASE_PRIVATE_URL=${{Postgres.DATABASE_PRIVATE_URL}}

Testing

After updating the template, we suggest deploying it to ensure it is working as expected.

Of course, if you have any trouble at all, we are here to help! Please post any questions or concerns in this thread, and we’ll jump in as soon as we can.

0 Replies

Loading...