ACF Pro as a Composer dependency (without committing your license key unencrypted)

It should be pretty much the same except you’ll just put the ACF key in your .env file manually rather than having Trellis create the .env on deployment. Does that make sense?

1 Like

Ah… great. Thank you!

Is it possible to update the documentation to reflect the update of private-composer-installer? The version currently included is conflicting with phpdotenv but the author recently published a new version (4.0) that fixes the bug.

1 Like

I use Bedrock/Trellis but only to deploy to kinsta. That means no local Vagrant deploy. I attempted the method to load ACF Pro with the license key in vault.yml.

When I run composer update on my local repo, it can’t resolve the ACF_PRO_KEY environment variable. This makes sense because there actually isn’t a local .env, it is on kinsta.

Running ansible deploy to kinsta does populate the .env file with the ACF key, However, the plugin doesn’t install because composer update failed and didn’t update composer.lock before deployment.

Seems a catch 22 here. There is no local deploy or local .env, but the remote deploy to kinsta needs there to be one.

Any thoughts for Kinsta/Trellis folks trying to use ACF Pro?

For local development, the key should be in the local .env file.
But for remote, the vault file and Trellis deploy should be already sufficient.
Be sure that the same variable name as in the composer.json is used among the local dev .env and Trellis vault files.

I don’t care much for how this tutorial requires the consumer to bump the plugin version manually anytime there’s a release.

Created this as a general-purpose alternative.

3 Likes

This is wonderful! Thank you for this contribution!

Update the link looks like this now: https://connect.advancedcustomfields.com/v2/plugins/download?p=pro&k={%ACF_PRO_KEY}&t={%version}

3 Likes

ACF have created their own way to do this now.

The news article:

The ACF guide:
https://www.advancedcustomfields.com/resources/installing-acf-pro-with-composer/

How we can use it:
https://roots.io/trellis/docs/composer-http-basic-authentication/

5 Likes

It would be nice to have an example for storing the ACF license information in Trellis vault,
when deploying the site.

1 Like

Yeah, i’m struggling with getting this to work.
I’ve added the key etc to the vault, but it’s still says that I must be using the interactive console to authenticate.

Which method are you struggling with? There are now a few described in this thread. If it’s the official ACF method, I recommend reaching out to their support for assistance.

I set up the new, official ACF PRO installation mechanism on a site and noticed some gotchas,
namely the password field must be non-empty and a full URL, not just the hostname – otherwise HTTP basic authentication will fail!

I documented the setup process in a little guide:

1 Like